Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Loop through controls on a form

Status
Not open for further replies.
Nov 19, 2003
42
GB
Hi,

Can someone tell me if its possible to loop through all of the controls on a form so I can tell if the user has entered any text in any of the textboxes/comboboxes etc?

I'm having a problem that when one user saves a particular record and then another user access that record and changes it, the record is saved as a new record instead of being updated in the table

Any suggestions?
It's probably so simple but I can't see it at the moment!

Thanks

Maria
 
I was just asking if your allowedit property was set to yes...... if it isnt, you will not be able to edit any record.
 
Attached code will cycle through all of the specific type of controls on a form. You can insert a variety of conditons or tests within the "if" statement.

Dim ctl As Control
For Each ctl In Me.Controls
If TypeOf ctl Is TextBox Then
ctl.Locked = False
End If
Next
For Each ctl In Me.Controls
If TypeOf ctl Is ComboBox Then
ctl.Locked = False
End If
Next
For Each ctl In Me.Controls
If TypeOf ctl Is CheckBox Then
ctl.Locked = False
End If
Next
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top