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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Code blowing up on Timer Event

Status
Not open for further replies.

netrusher

Technical User
Feb 13, 2005
952
US
Below is the code I have on a Timer Event that is supposed to take me to the Last EcnNbr that I was on before
the requery. I keep getting the following error:

Run-time error '3464':
Data type mismatch in criteria expression.
I am totally stumped and hope someone can help me understand what is wrong. I have
this same code on another Form and it works just fine. Hopefully this is just something stupid
I have done but I sure can't figure it out. PLEASE HELP!
Code:
Private Sub Form_Timer()

trCtlName = Screen.ActiveControl.Name
'Record
intID = Me.EcnNbr
Me.Requery
'Go to record
Me.Recordset.FindFirst "EcnNbr=" & intID
'Go to control
DoCmd.GoToControl strCtlName
End Sub
 
FYI,

I got the below code from another forum and it works.

Code:
Me.Recordset.FindFirst "EcnNbr='" & intID & "'"
 

My guess would be that in this case the problem is exactly what Access says, "Datatype mismatch in criteria expression"

You code is set up as if [EcnNbr} were Numeric and I suspect it's defined as Text. Try

Me.Recordset.FindFirst "[EcnNbr] = '" & [intID] & "'"

I expect on the other form where the ID number was Numeric, which is why it worked.

The Missinglinq

Richmond, Virginia

There's ALWAYS more than one way to skin a cat!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top