Need Help With Double Click Event

Yes, I believe that is what has happened with those two forms.

While we are on the subject, I have a 3rd form that instead of having a list box and a dblclick event, I have a unbound text box on the form with code behind a command button to search for the ID and thus populate the actual record related to the ID. I have this functionality on another form and it works like a charm, but I cant get it to work here. Any ideas?

Here is the code:

Code:
Private Sub cmdFind1_Click()
Me.Recordset.FindFirst "[ID] = & Nz(Me!txtIDFind, 0)"
End Sub

Very frustrated,

KJ
 
I think because, if it's unbound control then use a dot (.) not a bang (!) but most importantly (I spotted this 2nd ;)) the quotes were in the wrong place:

Private Sub cmdFind1_Click()
Me.Recordset.FindFirst "[ID] = " & Nz(Me.txtIDFind, 0)
End Sub

Generally, dot tells access it's a control, bang tell's it it's a field. (I expect to be told that's not always true but it works for me.) So, for unbound control there is no field - use a dot.
 
Still doesnt work. I hit the 'Find' button and nothing...not even a runtime or syntax error or something like that.
 
Put a break point on it. Does the code actually run?
 
The code is firing, I put the following code in front of the search itself:

Code:
MsgBox me.txtIDFind, 0
And it returned the appropriate ID that I am asking it to search for.

Was that a proper breakpoint for that code or should I have done something else?

KJ
 
No, that will do to check.

The one thing is, normally I would find in a form's recorset this way:

Code:
Private Sub cmdFind1_Click()
    Dim rsMe as DAO.Recordset
    Set rsMe = Me.Recordset
    rsMe.FindFirst "[ID] = " & Nz(Me.txtIDFind, 0)
    Set rsMe = Nothing
End Sub

Apart from that I just wonder about the form's recordset type. Perhaps that could stop the FindFirst method from working.
 
I changed the code to the code you provided and still nothing...

Recordset Type: Dynaset

I am at a loss.
 
Try changing it to

Private Sub cmdFind1_Click()
Me.Filter = "[ID] = " & Nz(Me.txtIDFind, 0)
Me.FilterOn = True
End Sub

Does it filter to no records or the right one?
 
That would be why it doesn't find it: That ID does not exist in the form's recordset.

You're going to have to work out why. I can't help from here.
 
Well, I appreciate your time. I will possibly try to recreate the form and see if I can follow what happened. Right now the form is quite complicated and I couldnt begin to troubleshoot a record source issue.

I will keep you updated if I find something...

Thanks again,

KJ
 

Users who are viewing this thread

Back
Top Bottom