combo box afterupdate

A

Ann

I have a combo box that I want to update a text box when
you select a record. I can't figure out what the problem
is with the bookmark.

The combo box row source is:

SELECT [APPLICANT_T].[VENDORID],
[APPLICANT_T].[VENDOR_NAME] FROM [APPLICANT_T] ORDER BY
[VENDORID], [VENDOR_NAME];


The event is:

Private Sub Combo24_AfterUpdate()
' Find the record that matches the control.
Me.RecordsetClone.FindFirst "[VENDORID]
= '" & Me![Combo24] & "'"
Me.Bookmark = Me.RecordsetClone.Bookmark

When I select a record from the Combo box, I get a
runtime error 3021 no current record.

I am new at this. I would appreciate any help.
Thanks
 
K

Ken Snell [MVP]

Is VENDORID a text-format field? Or a numeric field? If it's text, what you
have should work if such a record is in the recordset.

However, if VENDORID is a numeric field, then you don't need the delimiting
' characters:

Me.RecordsetClone.FindFirst "VENDORID =" & Me![Combo24]
 
A

Ann

It is a text-format field.
-----Original Message-----
Is VENDORID a text-format field? Or a numeric field? If it's text, what you
have should work if such a record is in the recordset.

However, if VENDORID is a numeric field, then you don't need the delimiting
' characters:

Me.RecordsetClone.FindFirst "VENDORID =" & Me![Combo24]
--

Ken Snell
<MS ACCESS MVP>

I have a combo box that I want to update a text box when
you select a record. I can't figure out what the problem
is with the bookmark.

The combo box row source is:

SELECT [APPLICANT_T].[VENDORID],
[APPLICANT_T].[VENDOR_NAME] FROM [APPLICANT_T] ORDER BY
[VENDORID], [VENDOR_NAME];


The event is:

Private Sub Combo24_AfterUpdate()
' Find the record that matches the control.
Me.RecordsetClone.FindFirst "[VENDORID]
= '" & Me![Combo24] & "'"
Me.Bookmark = Me.RecordsetClone.Bookmark

When I select a record from the Combo box, I get a
runtime error 3021 no current record.

I am new at this. I would appreciate any help.
Thanks


.
 
K

Ken Snell [MVP]

Then what the error is telling you is that no record in the form's
recordsetclone has a VENDORID that matches your choice. Two possible
reasons:

(1) there is no such record;

(2) the record is not being searched by FindFirst because you aren't
moving recordsetclone to first record first. Try changing your code to this:

' Find the record that matches the control.
With Me.RecordsetClone
.MoveFirst
.FindFirst "[VENDORID] = '" & Me![Combo24] & "'"
If .NoMatch = True Then
MsgBox "No such record found!"
Else
Me.Bookmark = Me.RecordsetClone.Bookmark
End If
End With

--

Ken Snell
<MS ACCESS MVP>


Ann said:
It is a text-format field.
-----Original Message-----
Is VENDORID a text-format field? Or a numeric field? If it's text, what you
have should work if such a record is in the recordset.

However, if VENDORID is a numeric field, then you don't need the delimiting
' characters:

Me.RecordsetClone.FindFirst "VENDORID =" & Me![Combo24]
--

Ken Snell
<MS ACCESS MVP>

I have a combo box that I want to update a text box when
you select a record. I can't figure out what the problem
is with the bookmark.

The combo box row source is:

SELECT [APPLICANT_T].[VENDORID],
[APPLICANT_T].[VENDOR_NAME] FROM [APPLICANT_T] ORDER BY
[VENDORID], [VENDOR_NAME];


The event is:

Private Sub Combo24_AfterUpdate()
' Find the record that matches the control.
Me.RecordsetClone.FindFirst "[VENDORID]
= '" & Me![Combo24] & "'"
Me.Bookmark = Me.RecordsetClone.Bookmark

When I select a record from the Combo box, I get a
runtime error 3021 no current record.

I am new at this. I would appreciate any help.
Thanks


.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top