Reference Form Field through a Module

S

sandog

Is there a way that I can reference a form feild through a module?

I used this in the class objects code for the Form and it worked fine?
Label373.Visible = True
Label377.Visible = True

When I add the code to the Module and compile it I get an error,
"invalid qualifier"

I tried a few different things,
1. tried initializing the variables
Dim Label373 As String
Dim Label377 As String

2. tried calling out the Form and the field.
Forms(Form_CattHBApp).Conrols(Label373.Visible) = True
Forms(Form_CattHBApp).Conrols(Label377.Visible) = True

I still get the error "invalid qualifier" when i tried this.

Stil can't get it to work.

Help please....

thanks
 
D

Dirk Goldgar

sandog said:
Is there a way that I can reference a form feild through a module?

I used this in the class objects code for the Form and it worked fine?
Label373.Visible = True
Label377.Visible = True

When I add the code to the Module and compile it I get an error,
"invalid qualifier"

I tried a few different things,
1. tried initializing the variables
Dim Label373 As String
Dim Label377 As String

2. tried calling out the Form and the field.
Forms(Form_CattHBApp).Conrols(Label373.Visible) = True
Forms(Form_CattHBApp).Conrols(Label377.Visible) = True

I still get the error "invalid qualifier" when i tried this.


I gather that your form is named "CattHBApp". I believe, then, that what
you need in your module is this:

Forms!CattHBApp!Label373.Visible = True
Forms!CattHBApp!Label377.Visible = True

.... although this would also work:

Forms("CattHBApp").Controls("Label373").Visible = True
Forms("CattHBApp").Controls("Label377").Visible = True

Note that the form must already be open when this code runs.
 
S

sandog

I gather that your form is named "CattHBApp". I believe, then, that what
you need in your module is this:

Forms!CattHBApp!Label373.Visible = True
Forms!CattHBApp!Label377.Visible = True

... although this would also work:

Forms("CattHBApp").Controls("Label373").Visible = True
Forms("CattHBApp").Controls("Label377").Visible = True

Note that the form must already be open when this code runs.


That Worked!!!

Thanks
Sandon
 
S

sandog

That Worked!!!

Thanks
Sandon

Ooops.... I need some more help.
As you noted, "the form must be open when i run this code".

Well it runs perfect when I have that form open, but I get an error
message when I open another form.

Can you help me write an If statement that will check for the form?

thanks
 
D

Dirk Goldgar

sandog said:
As you noted, "the form must be open when i run this code".

Well it runs perfect when I have that form open, but I get an error
message when I open another form.

Can you help me write an If statement that will check for the form?


I'm not sure what you have in mind. What do you want to have happen if form
CattHBApp is not open?
 

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