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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Combo Box Not in List Addition Problem

Status
Not open for further replies.

Cads

Technical User
Jan 17, 2000
40
GB
Problem to do with requerying the form after addition.

I'm using the 'Not in List' property associated with a Combo Box to add a new entry. When the item typed in is not in the list I take the user to another form where they enter additional data and then return them to the original form containing the combo box.

Everything works fine up to the point where the user returns to the form and I get the combo box to display the new value.

What the problem is is that the other fields on the screen get blanked out and the user has to re-enter them. I realise the reason for this is that in the data-entry form I requery the main form (see code below). If I don't do this the original data is retained but the screen does not allow any further updating - it locks.

I can think of 'messy' solutions to this problem but surely there must be a more elegant solution? Can anyone help, please?

Private Sub Form_Close()
' Closing the data-entry form called from the original
' form 'frmCall'
Dim frm As Form, cbo As ComboBox
If IsLoaded("frmCall") Then
Set frm = Forms![frmCall]
Set cbo = frm!Combo42
DoCmd.SelectObject acForm, "frmCall"
RunCommand acCmdSaveRecord
cbo.Requery
frm.Requery 'The form requery in question
End If
End Sub




Steve House
shouse@icaew.co.uk
 
Hi Steve,
As an option check out Thread181-62967 but for your case as it is, try:

If IsLoaded("frmCall") Then Forms!frmCall!Combo42.Requery

The save record and form requery are moving your record when you only want to requery your combo and add the new data. Cheers!
Gord
ghubbell@total.net
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top