Form opens with Option Group choice pre-selected (1 Viewer)

RJW

Registered User.
Local time
Today, 07:37
Joined
Sep 21, 2006
Messages
44
I have a form, called "Repairs" with an Option Group. Clicking a button in the Option Group will reveal a specific set of fields on the form. (That works fine)

Now I would like to add a button on a different form that opens the "Repairs" form with one of the Option Group choices already selected. I can accomplish this with ...

Forms!Repairs!Frame0.DefaultValue = 1

But the fields that should be revealed when clicking the button are not visible when the form opens.

How do I execute the "After Update" code for that button when the form opens?

Thanks for your help

RJ
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 04:37
Joined
Aug 30, 2003
Messages
36,133
You'd have to make it public and then call it with something like:

Forms!Repairs.Frame0_AfterUpdate()

which is untested.
 

RJW

Registered User.
Local time
Today, 07:37
Joined
Sep 21, 2006
Messages
44
Forms!Repairs.Frame0_AfterUpdate()

This line as is ... gives a syntax error (turns red)


RJ
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 04:37
Joined
Aug 30, 2003
Messages
36,133
Try

Call Forms!Repairs.Frame0_AfterUpdate()

I can open a db and test if that doesn't work.
 

RJW

Registered User.
Local time
Today, 07:37
Joined
Sep 21, 2006
Messages
44
Same result.

And to be clear ... the code, so far, in the command button is ...


DoCmd.OpenForm "Repairs", acNormal, "", "", , acNormal
Forms!Repairs!Frame0.DefaultValue = 1


RJ
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 04:37
Joined
Aug 30, 2003
Messages
36,133
Just tested and this worked in a test db:

Forms!Form1.Command3_Click

so try

Forms!Repairs.Frame0_AfterUpdate

Make sure you've changed Private to Public for the after update code.
 

RJW

Registered User.
Local time
Today, 07:37
Joined
Sep 21, 2006
Messages
44
That worked.

Must have been the "()"

Thanks pbaldy


RJ
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 04:37
Joined
Aug 30, 2003
Messages
36,133
Happy to help!
 

Users who are viewing this thread

Top Bottom