Select Case to change label

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have one form where I set the recordsource within the click event of the switchboard, depending on the recordsouce I want the label's caption for the form to change. However, once it sets the first caption it never changes even when the form is closed and the recordset changes.

I am using a simply select case statement is this not the way to go? BTW, the form has up to 8 different recordsets that could be applied, that's why I need the label's caption property of the form to change

Thank
Cathi
 
----- Cathi wrote: ----

I have one form where I set the recordsource within the click event of the switchboard, depending on the recordsouce I want the label's caption for the form to change. However, once it sets the first caption it never changes even when the form is closed and the recordset changes.

I am using a simply select case statement is this not the way to go? BTW, the form has up to 8 different recordsets that could be applied, that's why I need the label's caption property of the form to change

Thank
Cath

Hi Cathi, you might like to use online help for information about a form's OpenArgs property. Use this to set the labels' caption. Use the following as an example (air code

dim strOpenArgs as strin
dim strSQL as strin
dim strLabel as strin
dim strForm as strin

' you have code to determine recordsource (strSQL) and label caption (strLabel)

strForm = "formname

strOpenArgs = strSQL & "," & strLabe

docmd.openform FormName:=strForm, OpenArgs:=strOpenArg

' in form's OnLoad event...
' form has no saved recordsourc

dim strOpenArgs() as strin

' can only use split function in access version 2k(?) or later. alternative is to use combination of left and mid function
strOpenArgs=split(me.OpenArgs,","

me.recordsource=strOpenArgs(0
me.lblCaption.Caption=strOpenArgs(1

Luc
Jonatha
 
Back
Top