Solved

Using r.FindFirst and getting Data Type Mismatch

Posted on 2003-11-21
3
654 Views
Last Modified: 2008-03-10
I have a form with two search combo boxs from it I have a list of Envelope numbers in one box and a list of Names in another box.  My first Combo box is labeled SearchEnvNo
and my second box is labeled
SearchLastNameFirst

After the update of information in the box my underlying form is suppose to display the appropriate record based on the search criteria.  My 2nd box which is searching for a string (LastnameFirst) works.  But I can't figure out how to enter the R.FindFirst for an Integer which is what EnvNo is.    My code stops at the     R.FindFirst ("[EnvNo] = " & Chr(34) & Me![SearchEnvNo] & Chr(34))

with the error Data Type Mismatch in Criteria Expression.
*********************************
my code so far looks like this:
************************************
(This one does not work- Data type mismatch)

Private Sub SearchEnvNo_AfterUpdate()
    Dim R As Recordset
    Set R = Me.RecordsetClone
    R.FindFirst ("[EnvNo] = " & Chr(34) & Me![SearchEnvNo] & Chr(34))
    Me.Bookmark = R.Bookmark
    Me![SearchEnvNo] = Null
End Sub
**********************************
(This one Works)
Private Sub SearchLastNameFirst_AfterUpdate()
    Dim R As Recordset
    Set R = Me.RecordsetClone
    R.FindFirst ("[LastnameFirst] = " & Chr(34) & Me![SearchLastnameFirst] & Chr(34))
    Me.Bookmark = R.Bookmark
    Me![SearchLastnameFirst].Value = ""
End Sub

***********************************
Can someone help me with the code I need to be able to search for an integer from my Field EnvNo  my combo box is unbound but I don't have anything set for Format

Randy
0
Comment
Question by:rronne
  • 2
3 Comments
 
LVL 10

Accepted Solution

by:
jobrienct earned 125 total points
Comment Utility
try changing

R.FindFirst ("[EnvNo] = " & Chr(34) & Me![SearchEnvNo] & Chr(34))

to

R.FindFirst ("[EnvNo] = "  & Me![SearchEnvNo] )

regards,

John
0
 

Author Comment

by:rronne
Comment Utility
Thanks John,  that is just what it took.  I knew I was getting close but I just could not seem to figure it out.

Randy
0
 
LVL 10

Expert Comment

by:jobrienct
Comment Utility
Glad to help

John
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now