Requery not working??

Luddite Lad

Registered User.
Local time
Tomorrow, 09:48
Joined
Aug 23, 2005
Messages
177
I have an "On Double Click" code in the second Combo box of a cascading combo box set. The code below works fine on a normal Combo Box, but for some reason the Requery statement doesn’t seem to have any effect in this instance. The data that has been entered into "FRM_DelPoint" does not appear (in the second Combo box [Combo18]) unless the First combo box in the set is changed :mad:

What have I got wrong?


Private Sub Combo18_DblClick(Cancel As Integer)
On Error GoTo Err_combo18_DblClick
Dim lngcombo18 As Long

If IsNull(Me![Combo18]) Then
Me![Combo18].Text = ""
Else
lngcombo18 = Me![Combo18]
Me![Combo18] = Null
End If
DoCmd.OpenForm "FRM_DelPoint", , , , , , acDialog
DoCmd.GoToRecord , "FRM_DelPoint", acNewRec
Me![Combo18].Requery
If lngcombo18 <> 0 Then Me![Combo18] = lngcombo18

Exit_combo18_DblClick:
Exit Sub

Err_combo18_DblClick:
MsgBox Err.Description
Resume Exit_combo18_DblClick
End Sub
 
The 'Me' shorthand refers to the form that currently has focus. Since you have opened FRM_DelPoint just before this, 'Me' is taken to mean this form. Now I don't know which form Combo18 sits on, but I bet it's not FRM_DelPoint.
 
What I needed to do was a requery the combo box from which Combo18 is cascading before requering Combo18, as the new data had obviously not yet been picked up. Problem solved :o
 

Users who are viewing this thread

Back
Top Bottom