When ever I run the following code I get the runtime error. The field Device Id is an auto number field and the error points to the Do.Private Sub cmdEditRecord_Click()
Private Sub cmdEditRecord_Click()
Dim intDeviceID As Integer
If Me.lstDevices.ListIndex = -1 Then
MsgBox "Please select a Record"
Exit Sub
End If
intDeviceID = Me.lstDevices.Value
DoCmd.Close acForm, "Warranty Selection Form"
' DoCmd.OpenForm "Warranty Information Form", acNormal, , "DeviceID = " & intDeviceID
DoCmd.OpenForm "Warranty Information Form", acNormal, , "Device Id = " & intDeviceID
End SubOpenForm statement
Private Sub cmdEditRecord_Click()
Dim intDeviceID As Integer
If Me.lstDevices.ListIndex = -1 Then
MsgBox "Please select a Record"
Exit Sub
End If
intDeviceID = Me.lstDevices.Value
DoCmd.Close acForm, "Warranty Selection Form"
' DoCmd.OpenForm "Warranty Information Form", acNormal, , "DeviceID = " & intDeviceID
DoCmd.OpenForm "Warranty Information Form", acNormal, , "Device Id = " & intDeviceID
End SubOpenForm statement