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

Combo box

Status
Not open for further replies.

desireemm

Technical User
Dec 17, 2003
50
US
I need help bad guys.. I have a combo box that is suppose to find the record on my form according to the value I input. The problem is that it doesnt always work and I dont understand why??? I keep getting an visual basic error message
 
Have you used the Combo wizard ?
If not, try it.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Thats originally what I used was the combo box wizard.
 
I keep getting an visual basic error message
Any chance you could post the whole error message, which line of code is highlighted by the debugger,... ie some consistent and relevant info.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
How are ya desireemm . . . . .

[blue]Post the error message! . . .[/blue]

[purple]Post the code thats executed so we can have a look! . . .[/purple]

Calvin.gif
See Ya! . . . . . .
 
ok thanks guys

Code:
Private Sub Combo175_AfterUpdate()
    ' Find the record that matches the control.
    Dim rs As Object

    Set rs = Me.Recordset.Clone
    rs.Find "[TM#] = " & Str(Nz(Me![Combo175], 0))
    If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub
 
PHV said:
Any chance you could post the [highlight]whole error message[/highlight], which [highlight]line of code is highlighted[/highlight] by the debugger
mdb or adp ? Seems like ADO syntax.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
I tried that I have a jpg of it but you cant post those here at least not that i can see

this is the part thats in yellow

Code:
Me.Bookmark = rs.Bookmark

 
I have a relationship going on there two does that matter theres a one to many relationship
 
desireemm . . . . .

The following code requires [purple]Microsoft DAO 3.6 Object Library[/purple] to run. To [blue]check/install[/blue] the library, in any code window click [blue]Tools[/blue] - [blue]References...[/blue] In the listing find the library and [blue]make sure its checked.[/blue] Then using the up arrow, [purple]push it up as high in priority as it will go[/purple]. Click OK.

Then replace the code you've posted with the following:
Code:
[blue]   Dim rs As DAO.Recordset
   
   Set rs = Me.RecordsetClone
   rs.Find "[TM#] = '" & Me![Combo175] & "'"
   If Not rs.EOF Then Me.Bookmark = rs.Bookmark[/blue]
From the code you posted, it appears [purple][TM#][/purple] is text . . .

If this fails, be sure to post the info queried by [blue]PHV![/blue]

Calvin.gif
See Ya! . . . . . .
 
I guess a type mismatch error ...
Try this code:
Dim rs As DAO.Recordset
Set rs = Me.RecordsetClone
rs.FindFirst "[TM#] = " & Str(Nz(Me![Combo175], 0))
If Not rs.EOF Then Me.Bookmark = rs.Bookmark


Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top