Okay - I am close.
I have the Combo18 defaulted to 0
when I click the button - if the Combo18 is 0, it opens Form 00_360_Request_360 to a new record, this works fine
I want : If Combo18 is not 0 (Combo18 is populated from the Primary Key "TicketID" (AutoNumber) on the table) or >0 I want it to open to the record number that is in Combo18
Code so far:
Code:
Private Sub Command0_Click()
Dim VarID As Integer
VarID = Me.Combo18
If VarID = 0 Then
DoCmd.OpenForm "00_360_Request_360", , , , , acHidden
DoCmd.GoToRecord acDataForm, "00_360_Request_360", acNewRec
DoCmd.OpenForm "00_360_Request_360", , , , , acDialog
ElseIf VarID > 0 Then
DoCmd.OpenForm "00_360_Request_360", , , , , acHidden
DoCmd.GoToRecord acDataForm, "00_360_Request_360", "TicketID=" & VarID
DoCmd.OpenForm "00_360_Request_360", , , , , acDialog
End If
Error Msg: Type Mismatch on line:
Code:
DoCmd.GoToRecord acDataForm, "00_360_Request_360", "TicketID=" & VarID