Advertisement

05.17.2008 at 10:18AM PDT, ID: 23410904
[x]
Attachment Details

need to add data (row) into sub form(table) using command button and data from main form

Asked by onemadjan in Access Forms

Tags: microsoft, access, 2000

I have a form that verifies username and password (from tblPeople) and this is working fine. I need to include in the button click event code that will add a record to the sub form or sub table named tblLogin that would include the UserName, Password and also enter TimeIn (Now()) into a new record in the sub form.
Here is the code for the button so far:

Private Sub Command12_Click()
    If Combo8.Value = UserName.Value And Text10.Value = Password.Value Then
        MsgBox "match"  'used to test, will remove this msgbox
       
        'use variables to enter data into subform
        Dim Uname As String
        Dim Pcode As String
       
        Uname = Combo8.Value
        Pcode = Text10.Value
       
        'need code here to put data into subform named tblLogin_Subform
        'table name is "tblLogin" and fields are "UserName", "Password", "TimeIn"
       
        Combo8 = ""
        Text10 = ""
    Else
        MsgBox "Password does not match, please reenter"
        Text10 = ""
        Me.Text10.SetFocus
       
    End If
End Sub

thanks, onemadjanStart Free Trial
[+][-]05.17.2008 at 10:59AM PDT, ID: 21590240

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Access Forms
Tags: microsoft, access, 2000
Sign Up Now!
Solution Provided By: peter57r
Participating Experts: 1
Solution Grade: A
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628