Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Selecting newly added records from a combo box

Status
Not open for further replies.

davejackson

Technical User
May 8, 2001
34
GB
Hello,

I have two combos showing two different fields that are part of but are not bound to a table. If the combination of the two fields does not exist on the table as a single record the user is prompted to add a record via another form. So far so good. However, after the user has added the record, even though I can see the new record in the first combo box (which shows all fields), when I select the record, the new record is ignored and the record after is treated as selected. I can tell this as the 3rd column of the table is an autonumber that is being output to another field on my form. It seems like I have to update/refresh/requery something but I don't know what. Any suggestions would be most appreciated.

Thank you in advance,

Dave
 
On the exit event of the popup form that you enter the new data in issue a requery command to the combo box in question.
Joe Miller
joe.miller@flotech.net
 
Joe,

Thanks for your reply. Unfortunately it doesn't work. I can see the new record in the combo box. This includes the autonumber keyfield that was generated with the new record. However, after I select the new record on the combo box and move the 3rd column into my keyfield field (keyfield2), when I run the code:
Set rs = Me.Recordset.Clone
rs.findfirst "[keyfield] = " & Str(Me![keyfield2])
Me.Bookmark = rs.Bookmark
the code cannot find the new record. Therefore the current record remains the same as before with [keyfield] value returned the value of the existing record before the selection. However, if I exit the form and return when I select the new record the new bankID field is obviously picked up.

Any other ideas please?

Thanks in advance,

Dave

 
you could try using the lastmodified property
set rst.bookmark = rst.lastmodified
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top