Using Combo Boxes for Search Form in Read Only Mode (1 Viewer)

doco

Power User
Local time
Today, 08:07
Joined
Feb 14, 2007
Messages
482
I would like to take advantage of using combo boxes to search records on a form but do not want user to be able to edit or change any of the data. Setting the form to read only of course, disallows use of any controls on the form.

How is this done?

TIA
 

billmeye

Access Aficionado
Local time
Today, 11:07
Joined
Feb 20, 2010
Messages
542
You could place your ComboBox on a different form and add it as a subform, set that form to allow edits and perform your filter/search on the main form.
 

missinglinq

AWF VIP
Local time
Today, 11:07
Joined
Jun 20, 2003
Messages
6,420
Remove whatever you've done to make the Form Read-Only, 'mark' the one Control you want to be able to use, your Combobox, so that Access can recognize it, then loop thru all Controls and Lock those not 'marked.'

In Design View, select the Control you want to be functioning and go to Properties-Other and in the Tag Property box enter DoNotLock, just like that, no quotes.

Then place this code in the code window:
Code:
 Private Sub Form_Load()
 
Dim ctrl As Control

 For Each ctrl In Me.Controls
   If (TypeOf ctrl Is TextBox) Or (TypeOf ctrl Is CheckBox) Or (TypeOf ctrl Is ComboBox) Then
    If ctrl.Tag <> "DoNotLock" Then
     ctrl.Locked = True
    End If
   End If
  Next

End Sub


You should be set!

Linq ;0)>
 

Users who are viewing this thread

Top Bottom