Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2003

    Red face Unanswered: Current record update

    Okay, I know this is probably like the easiest thing to do ever, but I'm having a terrible time trying to figure it out on my own. I'm new to VB, so be gentle.

    I've got a table called ACTIVE with a column called LicSent. I've got a form that has LicSent and a button called PrintLicVer (among others). I want two things to happen when I hit the button: 1) Print a document called "License Verification" and 2) update the LicSent field with the current date for only the current record.

    So far, what I've got is:

    Private Sub PrintLicVer_Click()
    On Error GoTo Err_PrintLicVer_Click

    Dim stDocName As String
    Dim strSQL As String

    stDocName = "License Verification"
    DoCmd.OpenReport stDocName, acNormal, "This Record"

    DoCmd.SetWarnings (False)
    strSQL = "UPDATE tblACTIVE SET LicSent = #" & Date & "# WHERE ID = " & LicSent
    DoCmd.RunSQL strSQL
    DoCmd.SetWarnings (True)

    Exit Sub

    MsgBox Err.Description
    Resume Exit_PrintLicVer_Click

    End Sub

    I know I'm totally missing something easy, but I've been staring at it for a while and am a bit dazed. Help?!

  2. #2
    Join Date
    Sep 2003
    I forgot a couple of things:

    1) There's also an ID column in the ACTIVE table set to AutoNumber

    2) When I hit the button, the document comes out fine, but it doesn't populate the LicSent field.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts