Help with If Functions

blackie1982

Registered User.
Local time
Today, 11:07
Joined
Jul 2, 2004
Messages
18
Im sure that might be really simple but I just cant seem to get this if statement working. What I want to do is check a value in a form and then depending on that value open up the correct report. Heres my code

Dim stDocName As String
Dim docName As String
If (Forms![instrumentRecord]![CalibrationWQFNumber] = "WQF 7.6/1") Then
docName = "WQF761"
Else If (Forms![instrumentRecord]![CalibrationWQFNumber] = "WQF 7.6/4") Then
docName = "WQF764"
Else If (Forms![instrumentRecord]![CalibrationWQFNumber] = "WQF 7.6/22") Then
docName = "WQF7622"
Else docName = "WQF7625"
End If
stDocName = docName
DoCmd.OpenReport stDocName, acPreview
 
why don't you use the Case statement instead of the if statement ?
 
Cheers, got it working with the case statement
 

Users who are viewing this thread

Back
Top Bottom