Update or CancelUpdate wothout AddNew or Edit

ddrew

seasoned user
Local time
Today, 16:11
Joined
Jan 26, 2003
Messages
911
Ive had search around the forum and have found a few threads about this but cant pin it to anything that Im doing.

The error occurs when I choose from a combobox after having chosen a record from a listbox and then choose the same record again from the listbox and then choose from the combobox again.

This is the code for the listbox:
Code:
Private Sub List45_AfterUpdate()
    On Error GoTo List45_AfterUpdate_Err

    DoCmd.SearchForRecord , "", acFirst, "[DogID] = " & "'" & Screen.ActiveControl & "'"
    If Me.Discipline = "Detection" Then
        Me.Detection.Visible = True
        Me.GP.Visible = False
    Else
        Me.Detection.Visible = False
        Me.GP.Visible = True
    End If


List45_AfterUpdate_Exit:
    Exit Sub

List45_AfterUpdate_Err:
    MsgBox Error$
    Resume List45_AfterUpdate_Exit

End Sub

And this is the code for the combobox:

Code:
Private Sub Discipline_BeforeUpdate(Cancel As Integer)
    If Me.Discipline = "GP" Then
        Me.GP.Visible = True
        Me.Detection.Visible = False
    Else
        Me.Detection.Visible = True
        Me.GP.Visible = False
    End If
End Sub

Could someone help meout please?
 
You did not say what error you are getting? Try and refresh after exit or lose focus event.Just a stab in the dark! Just curious as to why you need a before update for your combo?
 
You did not say what error you are getting? Try and refresh after exit or lose focus event.Just a stab in the dark! Just curious as to why you need a before update for your combo?

On the form I have a tab control one tab is called "GP" the other is called "Detection", once I have chosen either GP or Detection from the combobox, the relevent tab appears.

as you suggested, Refresh on lost focus did it, many thanks.
 

Users who are viewing this thread

Back
Top Bottom