Control Visible

  • Thread starter Thread starter Tom
  • Start date Start date
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
 
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.
 
Back
Top