Form defaults to a different record when updated.


I

iain

I'm using a combo box to enter data into a particular field in existing
records.

In some of the records this field is blank and the combo box is not limited
to list so that new entries can be made.

Some of these new entries are required for two or more records in a row and
the combo box has to be requeried however, this does not seem to work unless
the form is also requeried and refreshed.

This send the form back to record one. How do I prevent this be able to tab
to the next record and select the previous entry from a refreshed combo box?
 
Ad

Advertisements

K

Klatuu

I would have to see the code that requeries the Combo to give you an idea as
to why you are required to requery the form. It should not be required.
Also, if you do a requery, a refresh is not necessary.

Is the Combo a bound control? That may have something to do with it.

But, there is a way to keep the form on the current record after requerying
the form. Here is an aircode example using a command button:

Private Sub cmdRequery_Click()
Dim lngCurrRec As Long

lngCurrRec = Me.txtRecID
Me.Requery
With Me.RecordsetClone
.FindFirst "[RecID] = " & lngCurrRec
If Not .NoMatch Then
Me.Bookmark = .Bookmark
End If
End With
End Sub
 
Ad

Advertisements

I

iain

Thanks. Removal of the requery statment has sufficed.

Working ok now.

Klatuu said:
I would have to see the code that requeries the Combo to give you an idea as
to why you are required to requery the form. It should not be required.
Also, if you do a requery, a refresh is not necessary.

Is the Combo a bound control? That may have something to do with it.

But, there is a way to keep the form on the current record after requerying
the form. Here is an aircode example using a command button:

Private Sub cmdRequery_Click()
Dim lngCurrRec As Long

lngCurrRec = Me.txtRecID
Me.Requery
With Me.RecordsetClone
.FindFirst "[RecID] = " & lngCurrRec
If Not .NoMatch Then
Me.Bookmark = .Bookmark
End If
End With
End Sub
--
Dave Hargis, Microsoft Access MVP


iain said:
I'm using a combo box to enter data into a particular field in existing
records.

In some of the records this field is blank and the combo box is not limited
to list so that new entries can be made.

Some of these new entries are required for two or more records in a row and
the combo box has to be requeried however, this does not seem to work unless
the form is also requeried and refreshed.

This send the form back to record one. How do I prevent this be able to tab
to the next record and select the previous entry from a refreshed combo box?
 

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