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

Data Type Mismatch while editing in DAO

Status
Not open for further replies.

CaptainBob007

Programmer
Dec 20, 2003
42
US
Hi -

I have a rather simple form that should run some rather simple code, but I keep on getting an error - more on that later.

I have a form with a field
Code:
PerNum
, where a permit number is entered. Once it is entered and the appropriate button clicked, the record with the corresponding permit number will have its
Code:
PickedUp
field changed to TRUE. (PickedUp is a boolean value, PerNum is text). The code is below.


Code:
Dim db As DAO.Database
Dim rcdPerIssued As DAO.Recordset

Set db = CurrentDb
Set rcdPerIssued = db.OpenRecordset("qryPermitsIssued")

rcdPerIssued.FindFirst "PerNum = " & Me.PerNum

If Not rcdPerIssued.NoMatch Then
    rcdPerIssued.Edit
        rcdPerIssued![PickedUp] = True
    rcdPerIssued.Update   
Else
    MsgBox "This permit number has not yet been issued", vbExclamation, "Permit Not Issued"
End If

When I run this, I get an error 3464 "data type mismatch in expression". The Line below is highlighted:
Code:
rcdPerIssued.FindFirst "PerNum = " & Me.PerNum
As I said before, PerNum is a text field, and it's a simple comparison - I cant figure out why it'd be a mismatch. I do have DAO 3.6 object library enabled, so I know that can't be the cause of the problem. Any advice would be greatly appreciated.

~Bob
 
Hi!

When text, you'll need text qualifiers ('):

[tt]rcdPerIssued.FindFirst "PerNum = '" & Me.PerNum & "'"[/tt]

- numerics don't need any, dates need hash (#)

HTH Roy-Vidar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top