Field visible depending on selection

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have two fields on my form asset type and number of licences
There are two type of assest (Hardware, Software).
I want the #of licences field to be invisible unless the user selectes
software from the asset type field

I know this has something to do with the visible property and I have b een
playing around with code, but can not get it to work.

Any help is much appreciated
Thanks!
 
Greg,
Don't use the # sign in your object names, it refers to date values.

Using the OnCurrent event of the form, and the AfterUpdate of AssetType field.
Me.AssetType.Visible = AssetType = "Software"
--
hth
Al Campagna . Candia Computer Consulting . Candia, NH USA
Microsoft Access MVP
http://home.comcast.net/~cccsolutions

"Find a job that you love, and you'll never work a day in your life."
 
Try

Me.[number of licences].Visible = (Me.[asset type] = "software")

This line of code should be located on the after update event of asset type
field, and if you move between records in that form, you need to write it on
the OnCurrent event of the form
 
Hey thanks, That works great!
One Question. If the Field is left blank and is null then I get an error.
How would I go about incorporating somthing into the code to fix this?

Ofer Cohen said:
Try

Me.[number of licences].Visible = (Me.[asset type] = "software")

This line of code should be located on the after update event of asset type
field, and if you move between records in that form, you need to write it on
the OnCurrent event of the form

--
Good Luck
BS"D


GregB said:
I have two fields on my form asset type and number of licences
There are two type of assest (Hardware, Software).
I want the #of licences field to be invisible unless the user selectes
software from the asset type field

I know this has something to do with the visible property and I have b een
playing around with code, but can not get it to work.

Any help is much appreciated
Thanks!
 
Try to use the Nz function to replace the Null with a different value

Me.[number of licences].Visible = (Nz(Me.[asset type],"") = "software")

--
Good Luck
BS"D


GregB said:
Hey thanks, That works great!
One Question. If the Field is left blank and is null then I get an error.
How would I go about incorporating somthing into the code to fix this?

Ofer Cohen said:
Try

Me.[number of licences].Visible = (Me.[asset type] = "software")

This line of code should be located on the after update event of asset type
field, and if you move between records in that form, you need to write it on
the OnCurrent event of the form

--
Good Luck
BS"D


GregB said:
I have two fields on my form asset type and number of licences
There are two type of assest (Hardware, Software).
I want the #of licences field to be invisible unless the user selectes
software from the asset type field

I know this has something to do with the visible property and I have b een
playing around with code, but can not get it to work.

Any help is much appreciated
Thanks!
 
forgot about that
Works great
THanks a lot!

Ofer Cohen said:
Try to use the Nz function to replace the Null with a different value

Me.[number of licences].Visible = (Nz(Me.[asset type],"") = "software")

--
Good Luck
BS"D


GregB said:
Hey thanks, That works great!
One Question. If the Field is left blank and is null then I get an error.
How would I go about incorporating somthing into the code to fix this?

Ofer Cohen said:
Try

Me.[number of licences].Visible = (Me.[asset type] = "software")

This line of code should be located on the after update event of asset type
field, and if you move between records in that form, you need to write it on
the OnCurrent event of the form

--
Good Luck
BS"D


:

I have two fields on my form asset type and number of licences
There are two type of assest (Hardware, Software).
I want the #of licences field to be invisible unless the user selectes
software from the asset type field

I know this has something to do with the visible property and I have b een
playing around with code, but can not get it to work.

Any help is much appreciated
Thanks!
 

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

Back
Top