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 / Forms / July 2008

Tip: Looking for answers? Try searching our database.

Making blank fields hidden on a form

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
rye1982 - 30 Jul 2008 19:56 GMT
Hello,

When my form loads, I'd like it to check if a certain couple of fields are
blank, and if so, make them invisible. How can I do this?

Also, is it possible to shift other fields up when one becomes invisible?
For example, it would normally appear as:
Field 1
Field 2
Field 3
But if Field 2 was blank, it would appear as:
Field 1

Field 3
Yet I want to be able to have it appear as (if Field 2 was blank):
Field 1
Field 3

Any help would be appreciated.

Thank you.
Mr B - 30 Jul 2008 22:29 GMT
rye1982,

First, forms do not have fields.  Tables have fields.  Forms have controls.  
Controls can be bound to fields, but controls can also be unbound and still
provide functionality in certain situation.  It will help you in future
posting if you refer to the actual object types that you are needing help
with.

With that said,  all you are wantiing to do is possible.  However, you will
need to use either a macro or some VBA code to accomplish any of the things
you want to do.

I would suggest that you use VBA code for your purposes.  Just how the code
will need to be written will depend, to some degree, on what type of data is
being evaluated.  If you are dealing with only text then you could use some
code in the OnCurrent event of your form like:

If IsNull(me.NameOfFirstControl) Then
    Me.NameOfFirstcontrol.Visible = False
End If

You could repeat the code above (changing the "NameOfFirstControl" to the
actual name of the control you are evaluating) and use it for each control
that you wish to check.

If you have other types of data, such as a numeric value where the default
value of the field bound to the control is zero, then you would use a
different statement. Something like:

If Me.NameOfFirstControl = 0 then
    Me.NameOfFirstControl.Visible = false
End If

Hopefully this will shed a little light on how you can accomplish your
needs.  If not, please post back and I or someone else will try to help.
Signature

HTH

Mr B
askdoctoraccess dot com

> Hello,
>
[quoted text clipped - 17 lines]
>
> Thank you.
 
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.