Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Runtime error 3075 in Access 2010

Status
Not open for further replies.

N1WVU

MIS
Jul 16, 2012
3
US
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
 
An autonumber should be Dim'd as Long, not integer. I would use:
Code:
If IsNull(Me.lstDevices) Then
Also, it isn't clear whether the DeviceID field has a space in it or not. If it does, you must wrap it in []s.

Duane
Hook'D on Access
MS Access MVP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top