I am working on a code that will run a few queries then display the results in a form.
I need to be able to change the text contained within a label before the form is opened.
For example I allow the User to select a date banding in the Welcome form and then run the code.
I want the next form to open up with the Title "......Weeks..." if they selected the weeks Banding or ".....Months.." id they selected the Months banding.
My Current code looks like this:
Public Sub Run_Query_Click()
On Error GoTo Err_Run_Query_Click
DoCmd.SetWarnings False
Dim stDocName As String
stDocName = "Set_Dates"
DoCmd.OpenQuery stDocName, acNormal, acEdit
Call create_sql
DoCmd.RunSQL Final_sql
DoCmd.RunSQL query2
Exit_Run_Query_Click:
DoCmd.SetWarnings False
DoCmd.Close acQuery, "Set_Dates", acSaveYes
DoCmd.Close acQuery, "Menu", acSaveYes
stDocName = "03Campaigns"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit Sub
Err_Run_Query_Click:
MsgBox Err.Description
Resume Exit_Run_Query_Click
End Sub
This is contained within the Menu Form and calls into a Module.
The label I wish to change is in the Form [03Campaigns] and is called "Label23".
I've tried a few options such as the caption extension but it doesn't seem to work.
Does anyone have any ideas?
Many thanks