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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Combo box to find record in read only form

Status
Not open for further replies.

Larft

Technical User
Dec 9, 2002
55
I use a form to enter new records and update existing records in my DB and use a combo box in the form header to look up the record I want to edit. This functions perfectly but what I want to be able to do is to use the same form to also view records in read only mode, I have tried this by assigning a macro to a button to open the form as read only, the problem is that the combo box is then locked due to the state of the form so it no longer functions. I have too many controls on the form to want to mess with locking and unlocking them, any suggestions on the best approach for this? Is there code I can use to just lock the data but still be able to change the value in the combo box?

Thanks in advance!
 
Not sure if you can do that without locking the controls, but that is pretty easy since you combo is in the header. This is all you need to lock (modify to unlock) all the controls in the detail section

On Error GoTo errLbl
Dim CNTRL As Access.Control
For Each CNTRL In Me.Detail.Controls
CNTRL.Locked = True
Next CNTRL
errLbl:
If Err.Number = 438 Then
Resume Next
Else
MsgBox Err.Name & " " & Err.Number
End If
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top