If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Form defaults to a different record when updated.
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? |
#2
|
|||
|
|||
Form defaults to a different record when updated.
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" wrote: 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? |
#3
|
|||
|
|||
Form defaults to a different record when updated.
Thanks. Removal of the requery statment has sufficed.
Working ok now. "Klatuu" wrote: 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" wrote: 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? |
Thread Tools | |
Display Modes | |
|
|