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

BeforeUpdate

Status
Not open for further replies.

Jackxxx

Programmer
Jun 21, 2007
31
US
Is the beforeupdate event reliable? I have the following code in it for a drop down box and sometimes it does not put the order ID in when the user clicks Yes.

Private Sub Client_ID_BeforeUpdate(Cancel As Integer)
If Me.Client_ID.Column(6) = "Unpaid" Then
Msg = "This Client has an open order, would you like to post this payment to the open order?"
Style = vbYesNo + vbQuestion + vbDefaultButton2 ' Define buttons.
' ' Define title.
' Display message.
Response = MsgBox(Msg, Style, Title)
If Response = vbYes Then ' User chose Yes.
Me.cboEntryType = "Payment"
Me.Order_ID = Me.Client_ID.Column(7)
Else
'Cancel = True
End If
End If
End Sub
 
I have other things going on in the after update and thought this was best to ask before the update.
 
What happens if you add it to the After UPdate?
At the very least try add this line to put the value in the debug window:
Code:
   Debug.Print Me.Client_ID.Column(7)

Duane
Hook'D on Access
MS Access MVP
 
I think you really need to move that to the After Update. Unless you're looking to cancel an action carried out by the combo box, then I'd highly suggest moving it all to the AfterUpdate.

It might be that you want to blend this bit of code in with the AfterUpdate current code, but not knowing what you're doing currently in the AfterUpdate, we've no way to be able to say exactly how/where to do it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top