Macro

G

Guest

I need some help with building a macro.

On a form, how do you use the Set Value Macro to hide (visible=no) a control
based on the value in another field? What would you use for the Item and
Expression?

For example, "Abbreviations" is a yes or no question. Field "U" should not
be visible unless the answer to "Abbreviations" is yes.

Here's what I have and I get a type mismatch error.

Item: [Forms]![Chart Review]!.[Visible]
Expression: Yes

Condition: [Forms]![Chart Review]![Abbreviations]="Yes"
 
G

Guest

Much easier to do in VBA
You need to put code in two places. Once in the form's Current event so it
will set the visibility of U for existing records:

If Me.NewRecord Then
Me.U.Visible = False
Else
Me.U.Visible = Not Me.Abbreviations
End If

Then in the After Update event of Abbreviations

Me.U.Visible = Not Me.Abbreviations
 
G

Guest

Yes that was much easier and it works. Thanks!

Klatuu said:
Much easier to do in VBA
You need to put code in two places. Once in the form's Current event so it
will set the visibility of U for existing records:

If Me.NewRecord Then
Me.U.Visible = False
Else
Me.U.Visible = Not Me.Abbreviations
End If

Then in the After Update event of Abbreviations

Me.U.Visible = Not Me.Abbreviations
--
Dave Hargis, Microsoft Access MVP


benny said:
I need some help with building a macro.

On a form, how do you use the Set Value Macro to hide (visible=no) a control
based on the value in another field? What would you use for the Item and
Expression?

For example, "Abbreviations" is a yes or no question. Field "U" should not
be visible unless the answer to "Abbreviations" is yes.

Here's what I have and I get a type mismatch error.

Item: [Forms]![Chart Review]!.[Visible]
Expression: Yes

Condition: [Forms]![Chart Review]![Abbreviations]="Yes"
 
G

Guest

Glad I could help, benny.

As you progress in your experience with Access, you will find that Macros,
though usefull for some things, have their limitations.
Most professional Access developers don't use Macros because of the
limitations.
You time to learn VBA will be well spent.
These newsgroups are great resource for finding ways to use VBA to solve
your problems.
Best of luck to you.
--
Dave Hargis, Microsoft Access MVP


benny said:
Yes that was much easier and it works. Thanks!

Klatuu said:
Much easier to do in VBA
You need to put code in two places. Once in the form's Current event so it
will set the visibility of U for existing records:

If Me.NewRecord Then
Me.U.Visible = False
Else
Me.U.Visible = Not Me.Abbreviations
End If

Then in the After Update event of Abbreviations

Me.U.Visible = Not Me.Abbreviations
--
Dave Hargis, Microsoft Access MVP


benny said:
I need some help with building a macro.

On a form, how do you use the Set Value Macro to hide (visible=no) a control
based on the value in another field? What would you use for the Item and
Expression?

For example, "Abbreviations" is a yes or no question. Field "U" should not
be visible unless the answer to "Abbreviations" is yes.

Here's what I have and I get a type mismatch error.

Item: [Forms]![Chart Review]!.[Visible]
Expression: Yes

Condition: [Forms]![Chart Review]![Abbreviations]="Yes"
 

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