Null Values and editing records

G

Guest

I have a form with several combo boxes and text boxes. I would like "NA" to
be automatically entered for null values when the user tabs to the next box.

My second question: When viewing existing records I would like the form to
be "view only" so that records are not accidentally altered. Then perhaps
have a control button to "edit records" which would allow editing of the
current selection. Any ideas or suggestions much appreciated.
 
C

Carl Rapson

1. In the Exit event of the boxes, check for a Null value and set it to "NA"
instead:

If IsNull(txtThisControl) Then
txtThisControl = "NA"
End If

2. In the form Current event, lock the controls. In the Click event of the
"edit" button, unlock the controls. You can use something like this:

Sub LockControls(bLock as Boolean)
Dim ctl as Control
For Each ctl In Me.Controls
' Don't lock the edit button!
If ctl.Name <> "<name of edit button>" Then
ctl.Locked = bLock
End If
Next ctl
Exit Sub

Carl Rapson
 

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

Top