abelingaw 69 Posting Whiz in Training

Edit:

with adodc1

   .ConnectionString = connectdb
    .RecordSource = "Select * from 'tablename'"
    .Refresh

    .AddNew


        .Recordset.Fields("Tablecolumn name") = txtYourtextbox.Text

 'any entry on that specific textbox would be save to that specific column on your table
 'make sure your textbox control is connected to your adodc

    .Update
    end with
AndreRet commented: Plain and simple. Nice! +13
abelingaw 69 Posting Whiz in Training

Can you check this things?

  1. What is the max of your progress bar, is it 100?

  2. Interval of your timer control? though this won't cause the problem if > 0

Here's what i did for my backup module before:

  1. Same as you did, i have a timer and a progress bar. But I used FileSystemObject for it.

  2. Codes for my backup is on a sub-module

  3. And the progressbar increment process is on my timer control

  4. On the Backup Button, when it is clicked, the timer control will be enabled.

Note:

Make sure that the timer is disabled on form load/activate event.
The attachment is only from my Thesis Project so, it's only for a reference, you'll get it.

abelingaw 69 Posting Whiz in Training

If you really want to have your own domain, you need to pay.

But there are free webhosting services available, but the domain name would still include that sites domain.

say a webhost with a domain name

www.sample.com

If you use their free hosting, you'll be given a domain name of

www.yourgivendomain.sample.com

or something like that.

abelingaw 69 Posting Whiz in Training
Private Sub Text1_KeyPress(KeyAscii As Integer)
    Select Case KeyAscii
          Case 48 To 57, 8 
        Case Else
          KeyAscii = 0 
          Msgbox "Your Message Here"

    End Select
End Sub
abelingaw 69 Posting Whiz in Training
Raghu_Ganapm commented: Good answer +0
abelingaw 69 Posting Whiz in Training

On your save button code, put this between line 26 and 28.

frmList.Adodc.Refresh
frmList.DataGrid1.Refresh
abelingaw 69 Posting Whiz in Training

Replace your module code with this.

Public CN As New ADODB.connection
Public rs As New ADODB.Recordset

Public Sub CON()
With CN
    .Provider = "Microsoft.Jet.OLEDB.4.0"
    .ConnectionString = "Data Source=" & App.Path & "\Database1.mdb"
     ' so that you dont have to specify the whole drive path of your database
     ' database should be in the same folder as your app
    .Open
    .CursorLocation = adUseClient
End With
End Sub

Replace your Save button code with this.

Dim rstInfo As New ADODB.Recordset
Dim SQL As String

Call CON

SQL = "SELECT * FROM List"

    rstInfo.Open SQL, CN, adOpenStatic, adLockOptimistic
        
        rstInfo.AddNew


            rstInfo!CustomerName = txtName.Text
            rstInfo!ContactNumber = txtContact.Text
            rstInfo!Date = txtDate.Text
            rstInfo!TimeStart = txtStart.Text
            rstInfo!TimeEnd = txtEnd.Text
            rstInfo!Event = txtEvent.Text
            rstInfo!PossibleNumberofGuest = txtGuest.Text
            rstInfo!Comment = txtComment.Text
            
            
    rstInfo.Update
    
         MsgBox "Record has been Saved", vbInformation
    
    rstInfo.Close

CN.Close
    
Set rstInfo = Nothing
abelingaw 69 Posting Whiz in Training

I believe you already created a thread regarding this topic.

http://www.daniweb.com/forums/thread342079.html

Double posting.

peter_budo commented: Well spoted +16
abelingaw 69 Posting Whiz in Training

http://www.daniweb.com/forums/thread341763.html

Regards to that, i also wanted the system not to be able to delete Administrator Accounts

via my code also posted there.

Here's the code again:

Private Sub cmdDelete_Click()

 ' On Error GoTo err
    
    Dim intYN
    
    intYN = MsgBox("You are about to delete a record." & vbCrLf & _
        "If you click Yes, you won't be able to undo this delete operation." & _
        vbCrLf & vbCrLf & _
        "Are you sure you want to delete this record?", vbExclamation + vbYesNo, "Confirm Delete")
        
    If intYN = vbNo Then Exit Sub
    
    DBLink.Execute "Delete From Users Where ID = " & lvwUser.SelectedItem.Text
 
    DBLink.Close
    
    Call Form_Load
    
    txtName.Text = ""
    txtPass.Text = ""
    txtConfirm.Text = ""
   
    MsgBox "The Record has been deleted.", vbInformation

    
    Exit Sub
    
Err:
    MsgBox Err.Description, vbCritical

End Sub

My Database field is Users and has 4 fields.
UserType, ID, UserName and Password respectively.

If the user tries to delete an account where the UserType is Administrator, it wont be deleted, else if the UserType is User, it can be.

Sorry, I'm really not good in SQL. :$

AndreRet commented: Nice solution! +6
abelingaw 69 Posting Whiz in Training

Can you check your listview control columns if it corresponds to the number of your subitems.?

I think it needs 5 columns.

Nick Evan commented: Thank you for helping us fight spam! +16
abelingaw 69 Posting Whiz in Training

HHhmmm, it works sir but wont allow me to close the form if i try to cancel the Add operation.

Got a fixed though, have to create a DB Table which contains the Combobox list items and refer to it.

Public Sub Check()

Dim dbX As ADODB.Connection
Set dbX = New ADODB.Connection

dbX.CursorLocation = adUseClient
dbX.Open "PROVIDER=Microsoft.Jet.OLEDB.4.0; Data Source=" & App.Path & "\Database.mdb"

    Dim rsX As ADODB.Recordset
    Set rsX = New ADODB.Recordset
    'If rsX.State = adStateOpen Then rsX.Close
 
    rsX.Open "Select * from Gender", dbX, adOpenStatic, adLockOptimistic
    If cboGender.Text <> rsX.Fields("Gender") Then MsgBox "Select from the list.", vbExclamation, "Error": cboGender.SetFocus: Exit Sub
    
dbX.Close

End Sub

Just call for Check :idea:

AndreRet commented: Well done!!! +6
abelingaw 69 Posting Whiz in Training

yes sir, didn't work.

But fix already.

My mistake was using MS Windows Common Controls 5.0 and 6.0 at the same time.

Fix by removing 5.0. Haha, I'm such a noob.

Replies are appreciated, THanks.

AndreRet commented: Well done... +4
abelingaw 69 Posting Whiz in Training

Please mark thread as Solve..

Thanks

AndreRet commented: First solution, well done! +4
abelingaw 69 Posting Whiz in Training

Thanks so much.

I'm lazy in creating reports, REALLY.

//SOLVED

abelingaw 69 Posting Whiz in Training

I finally got it.

User = cWords(txtUser.Text)
                    CurrentPosition = rs.Fields("UserType")
                                                
                    With Form2
                    
                    .StatusBar.Panels(2).Text = User
                    
                        If rs.Fields("UserType").Value = "Admin" Then
                            
                            .Toolbar1.Enabled = True
                        
                        Else
                            
                            .Toolbar1.Enabled = False
                            
                            .mnuNewEmp.Enabled = False
                            .mnuCpayroll.Enabled = False
                            .mnuEmpinfo.Enabled = False
                            .mnuEmpdtr.Enabled = False
                            .mnuPayslip.Enabled = False
                            .mnuBackup.Enabled = False
                            .mnuRestore.Enabled = False
                            .mnuUreg.Enabled = False
     
                        End If
                              
                        
                            End With
                        Unload Me
                        Form2.Show

Thanks again sir.

//SOLVED

AndreRet commented: Well done! +4