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
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