Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms / May 2007

Tip: Looking for answers? Try searching our database.

Run time error

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Natasha - 27 May 2007 20:46 GMT
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
Scott McDaniel - 27 May 2007 21:13 GMT
>I am getting this run time error
>Run Time error 2498
[quoted text clipped - 3 lines]
>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
Natasha - 27 May 2007 23:14 GMT
How do i set a break point in that line?

> >I am getting this run time error
> >Run Time error 2498
[quoted text clipped - 12 lines]
> scott@takemeout_infotrakker.com
> www.infotrakker.com
Douglas J. Steele - 27 May 2007 23:38 GMT
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.

Signature

Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)

> How do i set a break point in that line?
>
[quoted text clipped - 16 lines]
>> scott@takemeout_infotrakker.com
>> www.infotrakker.com
Natasha - 27 May 2007 23:16 GMT
How do i set a breakpoint in that line?

> >I am getting this run time error
> >Run Time error 2498
[quoted text clipped - 12 lines]
> scott@takemeout_infotrakker.com
> www.infotrakker.com
Natasha - 28 May 2007 00:42 GMT
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

> How do i set a breakpoint in that line?
>
[quoted text clipped - 14 lines]
> > scott@takemeout_infotrakker.com
> > www.infotrakker.com
Scott McDaniel - 28 May 2007 14:12 GMT
>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
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.