Making Main Form Read Only

  • Thread starter Thread starter Natalie_Allen
  • Start date Start date
N

Natalie_Allen

Hi, I am trying to make my main form read only until they click a
button called "Start Editing". I have this working but when I make the
form read only, it disables the lookup drop down to search through the
data. Can anybody help. It seems to easy!
 
This is indeed a sideeffect of setting AllowEdits = False
I Usually circumvent using the Tag Property & a TextBox (EditEnable)

Private Sub Form_Current()
Dim C As Access.Control
For Each C In Me.Controls
Select Case C.ControlType
Case acControlType.acListBox, acControlType.acComboBox,
acControlType.acTextBox, _
acControlType.acCheckBox, acControlType.acBoundObjectFrame, _
acControlType.acObjectFrame, acControlType.acOptionGroup, _
acControlType.acSubform, acControlType.acToggleButton
C.Locked = VBA.IIf(VBA.InStr(C.Tag, "ReadOnly") > 0, Not
Me.EditEnable.Value, C.Locked)
Case acControlType.acCommandButton
C.Enabled = VBA.IIf(VBA.InStr(C.Tag, "ReadOnly") > 0,
Me.EditEnable.Value, C.Enabled)
Case Else ' Don't bother
End Select
Next
End Sub

HTH

Pieter
 

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

Back
Top