poohbear2012
Registered User.
- Local time
- Today, 09:37
- Joined
- Jan 8, 2012
- Messages
- 30
Hi
I am a self-taught beginner VBA scriptor and I am encountering the Run-time error '2465' on a few of my forms with the error occurring on the same line (in bold below). Not sure how to correct it as the reference to the table and field is correct.
Private Sub Form_Open(Cancel As Integer)
Dim db As Database
Dim rsDemography As Recordset
Dim customercount As String
Set db = CurrentDb
Set rsDemography = db.OpenRecordset("SELECT * FROM tblDemography ORDER BY [customerNumber]", dbOpenDynaset)
If rsDemography.RecordCount = 0 Then
customercount = 1001
Else
customercount = DMax("[tbldemography].[customerNumber]", "tbldemography") + 1
End If
Me.[tblcustomerdetails].[CustomerNumber] = customercount
End Sub
Many thanks
Trisha
I am a self-taught beginner VBA scriptor and I am encountering the Run-time error '2465' on a few of my forms with the error occurring on the same line (in bold below). Not sure how to correct it as the reference to the table and field is correct.
Private Sub Form_Open(Cancel As Integer)
Dim db As Database
Dim rsDemography As Recordset
Dim customercount As String
Set db = CurrentDb
Set rsDemography = db.OpenRecordset("SELECT * FROM tblDemography ORDER BY [customerNumber]", dbOpenDynaset)
If rsDemography.RecordCount = 0 Then
customercount = 1001
Else
customercount = DMax("[tbldemography].[customerNumber]", "tbldemography") + 1
End If
Me.[tblcustomerdetails].[CustomerNumber] = customercount
End Sub
Many thanks
Trisha
