changing label text when using different button on form

megatronixs

Registered User.
Local time
Today, 09:33
Joined
Aug 17, 2012
Messages
719
Hi all,

I'm looking for a solution to change the name of a label depending on wich button was selected.
I have a main form "frm_Main_Review" and inside there is a subform called "frm_QC_Main" I have 5 dates fields and next to those date fields I have 5 buttons to open 1 form (it will be the same form everytime) I called it "frm_QC_Insert" (inside the table from it, there are 5 diffrent date fields)
what I need to do is to change the title label in the "frm_QC_Insert" depending if button 1, button 2, it should change the caption to "QC Date 1" or QC Date 2"

Any way to do this?

I tried this, but no luck:

Code:
Me!frm_Main_Review!frm_QC_Main!frm_QC_Insert!Label401.Caption = "QC Date 1"

Greetings.
 
Hi Minty,

This will be harder to do as the forms that opens where I want to change the label, it is not a subform, just a standalone form.

Greetings.
 
The code that opens the form (docmd.openform) includes an argument option called OpenArgs. This is just a string that gets passed to the form and you can refer to this value in the form. So pass an value for OpenArg (depending on what you want the title to be. Then in the On Load event of the form, set the label caption to me.openargs.

hth
 
if frm_QC_Insert is inside frm_QC_Main:

Me!frm_QC_Insert.Form!!Label401.Caption = "QC Date 1"

if it is a pop-up:

[Forms]![frm_QC_Insert]!label401.Caption = "QC Date 1"
 
Hi all,

I managed to make it work, after pulling a lot of hair.

Thank you all :-)

Greetings.
 

Users who are viewing this thread

Back
Top Bottom