setting variable of ActiveForm

Blkblts

Registered User.
Local time
Today, 07:56
Joined
Jan 21, 2000
Messages
61
Hay everyone and happy holidays....

I have a question and maybe you have a better solution then the way I am going about it.

I have vba code that based on a form sets some checkbox to true. The problem is I have several forms that use this same code so I have written several versions of this code changing the form name in each of them. I would like to use just one code and based upon the Form that is currently Active or Open plug that variable throughout. This is what works:

Dim Frm As Form
Set Frm = Screen.ActiveForm
MsgBox Frm.Name 'this tells me my form name that I am looking for.

What is not working is this next part:

Forms![Frm.name]![ChkCHF] = True

Acess sees Frm.name as the actual name of a form instead of the variable.

Thanks in advance for your help

Kim
 
Happy holidays to you too!
smile.gif


Here's the quick answer. Drop the word 'Forms!' from the beginning of your statement. Your dim statement has already defined 'Frm' as a form, so it's unnecessary. The code below should do the trick.

Frm![ChkCHF] = True

~Abby
 
You are exactly correct that worked perfectly....

kim
 

Users who are viewing this thread

Back
Top Bottom