Select Case to change label

C

Cathi

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
 
J

Jonathan Parminter

----- 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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top