I can't Find any reference to tell me what I am doing wrong here. Can someone please advise. The error I get is "expected object" and it highlights the first "=", but gives me no clues what is wrong.
Thanks, Ken
Option Compare Database
Option Explicit
Dim sera As String
Private Sub Command40_Click()
If Forms![MultiQuery]![Era] = 1 Then Set sera = "Current"
Else: Set sera = "History"
End If
If Forms![MultiQuery]![QueryChoice] = (1) Then DoCmd.OpenQuery [sera] & "Vital", acViewNormal, acReadOnly
ElseIf Forms![MultiQuery]![QueryChoice] = (2) Then DoCmd.OpenQuery [sera] & "ARU", acViewNormal, acReadOnly
ElseIf Forms![MultiQuery]![QueryChoice] = (3) Then DoCmd.OpenQuery [sera] & "STL", acViewNormal, acReadOnly
End If
End Sub
Thanks, Ken
Option Compare Database
Option Explicit
Dim sera As String
Private Sub Command40_Click()
If Forms![MultiQuery]![Era] = 1 Then Set sera = "Current"
Else: Set sera = "History"
End If
If Forms![MultiQuery]![QueryChoice] = (1) Then DoCmd.OpenQuery [sera] & "Vital", acViewNormal, acReadOnly
ElseIf Forms![MultiQuery]![QueryChoice] = (2) Then DoCmd.OpenQuery [sera] & "ARU", acViewNormal, acReadOnly
ElseIf Forms![MultiQuery]![QueryChoice] = (3) Then DoCmd.OpenQuery [sera] & "STL", acViewNormal, acReadOnly
End If
End Sub