Control Visible

T

Tom

What we would like to do on a client form is when the user clicks on a cmd
button for a new record all fields, about 20, apart from the clients
firstname and surname fields are not visible. After the user has entered
data into both of theses fields the remaining fields become visible.

What is best practise to achieve this

Using Access 2003

TIA

Tom
 
R

Rob Oldfield

Air code...

dim ctl as control
docmd.gotorecord ,,acnewrecord
for each ctl in me.controls
select case ctl.name
case "Firstname","Surname"
case else
ctl.visible=false
end select
next

....and then in the after update of the two controls run the same routine
that does something like...

dim ctl as control
if me.firstname<>"" and me.surname<>"" then
for each ctl in me.controls
ctl.visible=true
next
endif

This won't stop a user entering a first name and surname, editing the other
controls, and then deleting first name and surname. You'd need to play with
the before update events of those two to stop that happening.
 

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