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

Type Mismatch Error 1

Status
Not open for further replies.

mdmarney

IS-IT--Management
Jan 16, 2003
68
0
0
US
I am sure this is a simple question...

I am trying to use the MS code for a autolookup drop down on a tect box and button. I am using the following code:

Private Sub Command67_Click()
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[Last_Name] = " & Str(Nz(Me!Text62, 0))
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub

The following statement gives a type mismatch error...
rs.FindFirst "[Last_Name] = " & Str(Nz(Me!Text62, 0))

Help? Thanks! *************
M. MARNEY
 
try:
rs.FindFirst "[Last_Name] = '" & Nz(Me!Text62, "") & "'"

(generating)

[Last_Name] = 'xxx'
 
Hello M. MARNEY,
The problem that your are experiencing is caused because you are dealing with a string value, but you are inadvertently telling Access the you want to look up a numeric value. Here is the correct syntax:
Code:
rs.FindFirst "[Last_Name] = '" & Str(Nz(Me!Text62, 0)) & "'"
Hope this helps, Robert
•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•
Professional, affordable, Access database solutions and assistance °•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°
 
Too late :) Robert
•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•
Professional, affordable, Access database solutions and assistance °•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top