report based on combo box selection

R

rkg

I got some help regarding this report and I used the delimiter for
date. My combo box pops up and lists all the available dates. When I
click on the date i get the error message of "Date not found". Here is
my code:

Private Sub Combo7_AfterUpdate()
Dim strCriteria As String
strCriteria = "[entry_date]" = "#&Me.Combo7&#"
If Not IsNull(DLookup("entry_date", "qscale08", strCriteria)) Then
DoCmd.OpenReport "rscaletickets08", WhereCondition:=strCriteria
Else
MsgBox "Date not found", vbInformation, "Warning"
End If
End Sub

Private Sub Form_Current()
Combo7 = "entry_date"

End Sub
Should I have this code under the on click section?

Thanks,
rkg
 
F

fredg

I got some help regarding this report and I used the delimiter for
date. My combo box pops up and lists all the available dates. When I
click on the date i get the error message of "Date not found". Here is
my code:

Private Sub Combo7_AfterUpdate()
Dim strCriteria As String
strCriteria = "[entry_date]" = "#&Me.Combo7&#"
If Not IsNull(DLookup("entry_date", "qscale08", strCriteria)) Then
DoCmd.OpenReport "rscaletickets08", WhereCondition:=strCriteria
Else
MsgBox "Date not found", vbInformation, "Warning"
End If
End Sub

Private Sub Form_Current()
Combo7 = "entry_date"

End Sub
Should I have this code under the on click section?

Thanks,
rkg

Your quotes are positioned incorrectly.

strCriteria = "[entry_date] = #" & Me.Combo7 & "#"
 
R

rkg

I got some help regarding this report and I used the delimiter for
date. My combo box pops up and lists all the available dates. When I
click on the date i get the error message of "Date not found". Here is
my code:
Private Sub Combo7_AfterUpdate()
Dim strCriteria As String
    strCriteria = "[entry_date]" = "#&Me.Combo7&#"
If Not IsNull(DLookup("entry_date", "qscale08", strCriteria)) Then
    DoCmd.OpenReport "rscaletickets08", WhereCondition:=strCriteria
    Else
    MsgBox "Date not found", vbInformation, "Warning"
    End If
End Sub
Private Sub Form_Current()
Combo7 = "entry_date"
End Sub
Should I have this code under the on click section?
Thanks,
rkg

Your quotes are positioned incorrectly.

strCriteria = "[entry_date] = #" & Me.Combo7 & "#"- Hide quoted text -

- Show quoted text -

Thanks worked great.

rkg
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top