After Update on Form Open with Openargs??

MackMan

Registered User.
Local time
Today, 04:46
Joined
Nov 25, 2014
Messages
174
Hi Guys.

Is there a way to simulate the afterupdate event when a form loads using openargs ?

Basically, I have a form which is controlled by a combobox. It can either be opened from another form with the combobox value being pulled from another form, or it can be opened as it's own entity, and the combo box value selected.

When opened manually, and when a value is selected from the Combobox, an afterupdate event is fired from the combobox properties, and a few forms, and controls, based on it's value are hidden, refreshed, calculated and so on.

Is there a way I can do this automatically, when the form is opened via open args? Currently, when opening via openargs, the combobox value is there, but does nothing.

the form containing the openargs currently has this on a doubleclick event:

Code:
Private Sub Account_DblClick(Cancel As Integer)
    DoCmd.OpenForm "frmREGISTERmain", , , , , , AccountID
End Sub
The Openargs for the form being opened is:

Code:
Private Sub Form_Open(Cancel As Integer)
    Me.cboAccountSelect = Me.OpenArgs
End Sub
As always, many thanks for your help.
 
Personally I'd probably make a little form-level function and call it from both locations. You should be able to call the existing after update event with:

Code:
Private Sub Form_Open(Cancel As Integer)
    Me.cboAccountSelect = Me.OpenArgs
    cboAccountSelect_AfterUpdate
End Sub
 
Oh, and not sure what your code does but if a Null value would bother it you might want to test OpenArgs before doing any of that.
 
Hi Guys.

Many thanks for your replies.

Both work now, in each case both in different scenarios.

PB, I did check for null values, and just put in an

Code:
If IsNull(Me.OpenArgs) Then
Else
Me.cboAccountSelect = Me.OpenArgs
cboAccountSelect_AfterUpdate
End If
Perfect!

Uncle Gizmo, your method has helped me with a solution that's been niggling at me for weeks, the solution is a simple one (Once I got my head round it)

Again, many thanks.
 
Happy to help!
 

Users who are viewing this thread

Back
Top Bottom