openReport where form.field = date (1 Viewer)

bwc

Registered User.
Local time
Today, 17:06
Joined
Feb 7, 2013
Messages
22
i am sure that i am missing something simple. i have viewed pbaldy's thread, http://www.access-programmers.co.uk/forums/showthread.php?t=205231 and http://www.baldyweb.com/wherecondition.htm but my code still is not outputting what i expect.

my function is;
Code:
Function ckIn()
    Dim dbs As Database
    Set dbs = CurrentDb()
    dbs.Execute "INSERT INTO tblClinicData (clstrNameInd,clstrSSN,clstrLocation,cldatTimeIn,cldatDate,clstrPHA, " & _
                                           "clstrHIV,clstrOver40lab,clstrFlu,clstrHep,clstrTdap, " & _
                                           "clstrProfileReview,clstrOther,clstrRemarks,clstrCell)" & _
        "VALUES ('" & Forms!frmCheckIn.cboSoldierName.Column(0) & "', '" & Forms!frmCheckIn.cboSoldierName.Column(1) & "'," & _
                "'" & Forms!frmCheckIn.txtclstrLocation & "','" & Format(Time(), "hh:mm") & "','" & Format(Date, "yyyy-mm-dd") & "'," & _
                "'" & Forms!frmCheckIn.ckclstrPHA & "', '" & Forms!frmCheckIn.ckclstrHIV & "', '" & Forms!frmCheckIn.ckclstrOver40lab & "'," & _
                "'" & Forms!frmCheckIn.ckclstrFlu & "','" & Forms!frmCheckIn.ckclstrHep & "','" & Forms!frmCheckIn.ckclstrTdap & "'," & _
                "'" & Forms!frmCheckIn.ckclstrProfileReview & "','" & Forms!frmCheckIn.ckclstrOther & "'," & _
                "'" & Forms!frmCheckIn.txtclstrRemarks & "','" & Forms!frmCheckIn.txtclstrCell & "')"
 
    If Forms!frmCheckIn.ckclstrPHA = True Or Forms!frmCheckIn.ckclstrOver40lab = True Then
        DoCmd.OpenReport "rptPha", acViewPreview, , "cldatDate = #" & Forms!frmCheckIn.txtDate & "#", acNormal
    End If
    DoCmd.Close acForm, "frmCheckIn"
End Function
when i run the function, a prompt box asks for cldatDate rather then getting the date from Forms!frmCheckIn.txtDate. what am i missing?
 

CJ_London

Super Moderator
Staff member
Local time
Today, 23:06
Joined
Feb 19, 2013
Messages
16,610
From your error message, it sounds like your report does not have a cldatDate field
 

bwc

Registered User.
Local time
Today, 17:06
Joined
Feb 7, 2013
Messages
22
thank you cj, that did it
 

Users who are viewing this thread

Top Bottom