A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Form defaults to a different record when updated.



 
 
Thread Tools Display Modes
  #1  
Old October 22nd, 2009, 01:10 PM posted to microsoft.public.access.forms
Iain
external usenet poster
 
Posts: 112
Default 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  
Old October 22nd, 2009, 02:45 PM posted to microsoft.public.access.forms
Klatuu
external usenet poster
 
Posts: 7,074
Default 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  
Old October 24th, 2009, 11:39 AM posted to microsoft.public.access.forms
Iain
external usenet poster
 
Posts: 112
Default 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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 07:42 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.