?
Solved

Using r.FindFirst and getting Data Type Mismatch

Posted on 2003-11-21
3
Medium Priority
?
673 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 500 total points
ID: 9801789
try changing

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

to

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

regards,

John
0
 

Author Comment

by:rronne
ID: 9801867
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
ID: 9801898
Glad to help

John
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
Code that checks the QuickBooks schema table for non-updateable fields and then disables those controls on a form so users don't try to update them.
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses

829 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