do not allow data to change after record has been entered

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a field "callback number" that defaults to the callerID phone number.
HOwever, on the rare occasion that the callback number might be different
than the caller's usual phone number, the user needs to enter a new phone
number. But what I'm concerned about is that it is possible for a user to go
back in to the record and change the caller to another name (by accident or
on purpose) and would then lose the callback number because it will default
back to the new caller they just changed it to.

Is it possible to make the callback number disabled once someone has entered
some value other than the callerID's usual number?
 
I have a field "callback number" that defaults to the callerID phone number.
HOwever, on the rare occasion that the callback number might be different
than the caller's usual phone number, the user needs to enter a new phone
number. But what I'm concerned about is that it is possible for a user to go
back in to the record and change the caller to another name (by accident or
on purpose) and would then lose the callback number because it will default
back to the new caller they just changed it to.

Ummmm... no, it won't. A Default property is activated only when a new
record is created. Changing the value in the caller field will not
trigger the default property.
Is it possible to make the callback number disabled once someone has entered
some value other than the callerID's usual number?

I can't think of a good way - you could hack something up by changing
the textbox's Enabled property in the AfterUpdate event, but you'ld
also need to record that change in the Tag property. It would be
complicated but (as I suggest) it may be unnecessary.

John W. Vinson[MVP]
 
How about if the name is selected from a combo box, and the default value of
the phone number text box is not literally the default value property but
instead another (hidden) column in the combo box row source, and the combo
box After Update event evaluates the text box against that hidden column,
locking or unlocking the text box accordingly? I must say it is possible I'm
not quite understanding the question, since it is difficult to understand why
the phone number should not change if a new caller is selected.
 
The only way I can get the default value to appear is to code it under the
After Update property of the combo box that selects the caller name -
callbacknumber = combo177.value.

When I put the default value in the data tab of the properties of the
callback number, it doesn't appear - I am guessing because it has to wait
until the caller is chosen first.

The reason the caller name might change is that they deal with the media
quite frequently & many newspeople will call from the same company. I'm just
afraid they may decide to change the newsperson's name & lose the callback
number (someone's cell phone at the scene of a crime or whatever). It was
just a "rare possiblity that I wanted to protect it against.
 
My idea was to refer to the row source query for the combo box. Without
knowing details I will assume the key field is in the first column and the
name in the second. I was suggesting you could add the phone number to the
third column (I'm not sure how it would get there since I don't know how your
database is set up), then set the column count to 3 and the column widths to
0",1" (or whatever);0". You could use something like this in the combo box
After Update event to add the third column to the text box:
Me.txtPhoneNum = Me.cboComboBox.Column(2)
The first column is (0), so (2) is actually the third column.
To protect the phone number you could do something in the form's On Current
event like:
If Not IsNull Me.txtPhoneNum
Me.txtPhoneNum.Locked = True
End If

Then you could make the After Update event for the combo box something like:
If Isnull (Me.txtPhoneNum) Then
Me.txtPhoneNum = Me.cboComboBox.Column(2)
Else
Me.txtPhoneNum.Locked = True
End If

And set the Exit event for txtPhoneNum to:
If Not IsNull Me.txtPhoneNum Then
Me.txtPhoneNum.Locked = True
End If

You would probably want an Edit Phone Number command button or something to
unlock the text box in case you need to change the number.

I have used something similar in other instances, but have not tested it
specifically for your situation. If this is the right general idea you would
probably need to do some tweaking for the details of your setup. I have to
admit I am not sure if there is a flaw in my reasoning, and was hoping John
would weigh in again. I think this approach will work, but I have not tested
it extensively.

By the way, default value is a specific property of the control (txtPhoneNum
in this case). Assigning a value to a control based on another control can
be a little different from default value, even though the effect is similar.
Asking a question about default value may lead to answers that deal
specifically with that, even if it is not quite what you need.
 
Back
Top