Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / New Users / October 2007

Tip: Looking for answers? Try searching our database.

Macro

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
benny - 18 Oct 2007 15:26 GMT
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]![U].[Visible]
Expression:  Yes

Condition:  [Forms]![Chart Review]![Abbreviations]="Yes"
Klatuu - 18 Oct 2007 19:30 GMT
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
Signature

Dave Hargis, Microsoft Access MVP

> I need some help with building a macro.
>
[quoted text clipped - 11 lines]
>
> Condition:  [Forms]![Chart Review]![Abbreviations]="Yes"
benny - 18 Oct 2007 20:54 GMT
Yes that was much easier and it works.  Thanks!

> Much easier to do in VBA
> You need to put code in two places.  Once in the form's Current event so it
[quoted text clipped - 25 lines]
> >
> > Condition:  [Forms]![Chart Review]![Abbreviations]="Yes"
Klatuu - 18 Oct 2007 20:59 GMT
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.
Signature

Dave Hargis, Microsoft Access MVP

> Yes that was much easier and it works.  Thanks!
>
[quoted text clipped - 27 lines]
> > >
> > > Condition:  [Forms]![Chart Review]![Abbreviations]="Yes"
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.