Results 1 to 3 of 3
  1. #1
    koolbugs is offline Novice
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Posts
    4

    How can i assign the ff. values to my table?

    how can I assign the following value to my table, its seems very basic but I cant get it done



    I have a Attendance Table where when I press the Login button, it will automatically assign values that I wanted to.

    'Get the password stored in Employees Table
    '
    If Me.txtpassword.Value = DLookup("password", "Employeetbl", "[username]= '" & Me.userCmbo.Value & "'") Then
    'Assign value to Attendancetbl
    Table!Attendancetbl!username = Me.userCmbo.Value
    Table!Attendancetbl!TimeIn = Now()

    '
    strMessage = "Time In Entred"
    strMessage = strMessage & vbCr & vbCr
    strMessage = strMessage & "Successfully Time In"
    Style = vbInformation
    strtitle = "Congratulation"
    MsgBox strMessage, Style, strtitle
    txtpassword.SetFocus

  2. #2
    c_smithwick is offline Underpaid Programmer
    Windows 7 Access 2003
    Join Date
    Jan 2010
    Location
    Lakeside, CA
    Posts
    49
    You need to open a recordset against the table and use the AddNew method

    Code:
    Public Sub AssignValue()
    Dim rst As DAO.Recordset
    Set rst = CurrentDb.OpenRecordset("Attendancetbl", dbOpenDynaset)
    If Me.txtpassword.Value = DLookup("password", "Employeetbl", "[username]= '" & Me.userCmbo.Value & "'") Then
        With rst
            .AddNew
            !UserName = Me.userCmbo.Value
            !TimeIn = Now() 'Assign value to Attendancetbl
            .Update
        End With
        rst.Close
        Set rst = Nothing
        
    MsgBox "Time In Entered" & vbCrLf & vbCrLf & "Successfully Time In", vbInformation, "Congratulations"
    txtpassword.SetFocus
        
    End If
    End Sub

  3. #3
    koolbugs is offline Novice
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Posts
    4
    Thanks a lot, works like charm...

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Duplicate Values in table
    By senthilrg in forum Queries
    Replies: 3
    Last Post: 12-18-2009, 09:24 PM
  2. assign value from list
    By roman.pro in forum Forms
    Replies: 0
    Last Post: 05-16-2009, 04:20 PM
  3. Assign A Sequential Number To A Table Row
    By KramerJ in forum Programming
    Replies: 11
    Last Post: 04-08-2009, 08:48 AM
  4. need query to assign sales leads to reps??
    By RickM in forum Queries
    Replies: 0
    Last Post: 03-12-2009, 02:44 PM
  5. Table values in forms
    By xzxz in forum Access
    Replies: 3
    Last Post: 10-28-2008, 08:29 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums