Run time error

  • Thread starter Thread starter Guest
  • Start date Start date
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
 
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

Are you sure there is a value in Me.CompanyName? Try setting a breakpoint on that line, then type this in the Immediate
window:

?Me.CompanyName



Scott McDaniel
scott@takemeout_infotrakker.com
www.infotrakker.com
 
How do i set a break point in that line?

Scott McDaniel said:
Are you sure there is a value in Me.CompanyName? Try setting a breakpoint on that line, then type this in the Immediate
window:

?Me.CompanyName



Scott McDaniel
scott@takemeout_infotrakker.com
www.infotrakker.com
 
How do i set a breakpoint in that line?

Scott McDaniel said:
Are you sure there is a value in Me.CompanyName? Try setting a breakpoint on that line, then type this in the Immediate
window:

?Me.CompanyName



Scott McDaniel
scott@takemeout_infotrakker.com
www.infotrakker.com
 
Open the code in the VB Editor and click in the margin to the left of the
line of code. A dot should appear in the margin, and the line should be
highlighted. Run your code, and it will stop when it reaches the breakpoint.
 
OK i got the breakpoint (dot on left matgin and line highlighted) when i go
to run sub/userform a new box comes up called macros what do i do with this i
trien putting in ?Me.Company, doesn't work
 
OK i got the breakpoint (dot on left matgin and line highlighted) when i go
to run sub/userform a new box comes up called macros what do i do with this i
trien putting in ?Me.Company, doesn't work

The breakpoint should throw you into the Visual Basic Editor ... at that point, you'd want to view the Immediate window
(Ctrl + G wil show this window), then type this in the Immediate window:

?Me.CompanyName

then press the Enter key ... this should show you the value that's currently in Me.CompanyName

Scott McDaniel
scott@takemeout_infotrakker.com
www.infotrakker.com
 
Back
Top