Hi First time user to any forum was wondering if there was any solution to my problem or if im tackling this in the wrong approach. I have a form with three fields cboServiceType with a value list, and two text boxes txtAfter and txtBefore. I want to on command click i want to open a Report Where the JobDate field in my Report is between the dates in my text boxes and = to my cboService type. my code i have so far is below i know it is wrong i was wondering if someone could help fix my error?
Cheers Krispy89
Code:
Private Sub cmdSelectType_Click()
Dim before As Date
Dim after As Date
before = Me.txtBefore
after = Me.txtAfter
Select Case True
Case (Me.cboServiceType = "S/V")
DoCmd.OpenReport "rptJobsBooked", acViewPreview, , "ServiceType = 'S/V' And before < JobDate < after"
Case (Me.cboServiceType = "S/C")
DoCmd.OpenReport "rptJobsBooked", acViewPreview, , "ServiceType = 'S/C' And before < JobDate < after"
Case (Me.cboServiceType = "I")
DoCmd.OpenReport "rptJobsBooked", acViewPreview, , "ServiceType = 'I' And before < JobDate < after"
Case (Me.cboServiceType = "Other")
DoCmd.OpenReport "rptJobsBooked", acViewPreview, , "ServiceType = 'Other' And before < JobDate < after"
End Select
End Sub
Cheers Krispy89
Code:
Private Sub cmdSelectType_Click()
Dim before As Date
Dim after As Date
before = Me.txtBefore
after = Me.txtAfter
Select Case True
Case (Me.cboServiceType = "S/V")
DoCmd.OpenReport "rptJobsBooked", acViewPreview, , "ServiceType = 'S/V' And before < JobDate < after"
Case (Me.cboServiceType = "S/C")
DoCmd.OpenReport "rptJobsBooked", acViewPreview, , "ServiceType = 'S/C' And before < JobDate < after"
Case (Me.cboServiceType = "I")
DoCmd.OpenReport "rptJobsBooked", acViewPreview, , "ServiceType = 'I' And before < JobDate < after"
Case (Me.cboServiceType = "Other")
DoCmd.OpenReport "rptJobsBooked", acViewPreview, , "ServiceType = 'Other' And before < JobDate < after"
End Select
End Sub