G
Guest
I am getting this run time error
Run Time error 2498
An expression you entered is the wrong data type for one of the arguments.
All of the data types are correct, does anyone know how i can fix this?
The code for the form is below DoCmd.FindRecord Me.CompanyName
is where the problen is
Option Compare Database
Option Explicit
Private Sub Add_Click()
On Error GoTo Err_Add_Click
'DoCmd.GoToRecord , , acNewRec
Exit_Add_Click:
Exit Sub
Err_Add_Click:
MsgBox Err.Description
Resume Exit_Add_Click
End Sub
Private Sub Close_Form_Click()
On Error GoTo Err_Close_Form_Click
DoCmd.Close
Exit_Close_Form_Click:
Exit Sub
Err_Close_Form_Click:
MsgBox Err.Description
Resume Exit_Close_Form_Click
End Sub
Private Sub CompanyName_AfterUpdate()
Me.CustomerID.SetFocus
DoCmd.FindRecord Me.CompanyName
'Me.CompanyName = Null
End Sub
Private Sub Form_Open(Cancel As Integer)
DoCmd.GoToRecord , , acNewRec
End Sub
Private Sub Servicefrequecy_AfterUpdate()
'this generates the next service date
If Servicefrequency = 3 Then
NextServiceDate = ServiceDate + 90
ElseIf Servicefrequency = 6 Then
NextServiceDate = ServiceDate + 182.62
End If
End Sub
Private Sub Servicefrequency_AfterUpdate()
'this generates the next service date
If Servicefrequency = 3 Then
NextServiceDate = ServiceDate + 90
ElseIf Servicefrequency = 6 Then
NextServiceDate = ServiceDate + 182.62
End If
End Sub
Private Sub Search_Click()
On Error GoTo Err_Search_Click
Screen.PreviousControl.SetFocus
DoCmd.DoMenuItem acFormBar, acEditMenu, 10, , acMenuVer70
Exit_Search_Click:
Exit Sub
Err_Search_Click:
MsgBox Err.Description
Resume Exit_Search_Click
End Sub
Private Sub Delete_Click()
On Error GoTo Err_Delete_Click
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
Exit_Delete_Click:
Exit Sub
Err_Delete_Click:
MsgBox Err.Description
Resume Exit_Delete_Click
End Sub
Run Time error 2498
An expression you entered is the wrong data type for one of the arguments.
All of the data types are correct, does anyone know how i can fix this?
The code for the form is below DoCmd.FindRecord Me.CompanyName
is where the problen is
Option Compare Database
Option Explicit
Private Sub Add_Click()
On Error GoTo Err_Add_Click
'DoCmd.GoToRecord , , acNewRec
Exit_Add_Click:
Exit Sub
Err_Add_Click:
MsgBox Err.Description
Resume Exit_Add_Click
End Sub
Private Sub Close_Form_Click()
On Error GoTo Err_Close_Form_Click
DoCmd.Close
Exit_Close_Form_Click:
Exit Sub
Err_Close_Form_Click:
MsgBox Err.Description
Resume Exit_Close_Form_Click
End Sub
Private Sub CompanyName_AfterUpdate()
Me.CustomerID.SetFocus
DoCmd.FindRecord Me.CompanyName
'Me.CompanyName = Null
End Sub
Private Sub Form_Open(Cancel As Integer)
DoCmd.GoToRecord , , acNewRec
End Sub
Private Sub Servicefrequecy_AfterUpdate()
'this generates the next service date
If Servicefrequency = 3 Then
NextServiceDate = ServiceDate + 90
ElseIf Servicefrequency = 6 Then
NextServiceDate = ServiceDate + 182.62
End If
End Sub
Private Sub Servicefrequency_AfterUpdate()
'this generates the next service date
If Servicefrequency = 3 Then
NextServiceDate = ServiceDate + 90
ElseIf Servicefrequency = 6 Then
NextServiceDate = ServiceDate + 182.62
End If
End Sub
Private Sub Search_Click()
On Error GoTo Err_Search_Click
Screen.PreviousControl.SetFocus
DoCmd.DoMenuItem acFormBar, acEditMenu, 10, , acMenuVer70
Exit_Search_Click:
Exit Sub
Err_Search_Click:
MsgBox Err.Description
Resume Exit_Search_Click
End Sub
Private Sub Delete_Click()
On Error GoTo Err_Delete_Click
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
Exit_Delete_Click:
Exit Sub
Err_Delete_Click:
MsgBox Err.Description
Resume Exit_Delete_Click
End Sub