Re: Change a form control's llow edits property to No if it is Not

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Try starting with what Crystal has at
http://www.accessmvp.com/Strive4Peace/VBA/Index.htm

Once you've mastered that, check out the references Jeff Conrad has at
http://www.accessmvp.com/JConrad/accessjunkie/resources.html#Books for which
books to look at.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)


"Chris v." <Chrisv@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:33A81CF5-3663-495D-9B23-124A2B91900F@xxxxxxxxxxxxxxxx
It worked like a charm. Thank you. Can you recommend how/where I can learn
VBA online or which book to start with, or both? Your code was most
helpful.
:)

"Douglas J. Steele" wrote:

Why not lock the control if it has data? In the Current event of the form
being used as a subform, try something like:

Private Sub Form_Current()

Dim ctlCurr As Control

For Each ctlCurr In Me.Controls
Select Case ctlCurr.ControlType
Case acTextBox, acListBox, acComboBox
ctlCurr.Locked = (Len(ctlCurr.Value & vbNullString) > 0)
End Select
Next ctlCurr

End Sub

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"Chris v." <Chrisv@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:70263424-E8C4-4508-ACAF-096723EE7A1B@xxxxxxxxxxxxxxxx
I'm using Access 2007 and have an "Input" form with sub forms. The Main
form's Allow Edits property is set to yes, while the controls on the
main
form are locked so the user can ONLY look-up clients. The sub forms is
where
the data entry happens. However, if the sub form already has data, that
data
shouldn't be modifiable. Yet, if any of the sub-form's fields are null,
I
want the user to be able to enter the appropriate data. So me questions
are:
1) How can I do this? and 2) Is this a bad design?





.



Relevant Pages

  • Re: Bound many controls to a "frame" in a form
    ... Private Sub SpeedMode_opt_AfterUpdate ... Dim ctlCurr As Control ... For Each ctlCurr In Me.Controls ... Doug Steele, Microsoft Access MVP ...
    (microsoft.public.access.forms)
  • Re: "Microsoft Access: Overflow" - displays on opening of form?
    ... Private Sub Form_Error ... MsgBox Err.Number ... Doug Steele, Microsoft Access MVP ...
    (microsoft.public.access.formscoding)
  • Re: Why is this an error?
    ... The vendors are in the cboxvendors, but if I select a branch ... Private Sub cboxBranch_AfterUpdate ... Doug Steele, Microsoft Access MVPhttp://I.Am/DougSteele ...
    (microsoft.public.access.formscoding)
  • Re: Timer Count Down
    ... Private Sub Form_Open ... Doug Steele, Microsoft Access MVP ... (no private e-mails, please) ...
    (microsoft.public.access.formscoding)
  • Re: Exit Function vs Exit Sub
    ... Doug Steele, Microsoft Access MVP ... As I said this works in sub, but in a function I change to Exit ... The code stops and I can set focus to a control. ...
    (microsoft.public.access.formscoding)