G
Guest
I have a field that i need to have disabled when the user enters info into
it. It accepts a number (which is a required field) that is used to determine
how many rows to insert into a table and then display on the next form that
opens. After they are created, when the button on the first form is clicked,
instead of creating new records, it retrieves the ones created the first
time. Therefore, changing this number on the first form will have no effect
on the number of rows created in the table. I want to gray out the text field
*only if/after* the user has entered that number. For some reason, when I
tried
Private Sub txtLayers_AfterUpdate()
' If txtLayers > 0 Then
' ActualSpcWdth.SetFocus
' txtLayers.Enabled = False
' End If
End Sub
it grays out this field on *all* records... even the ones that are either
blank or have 0's. (some were able to be created without entering this field
because I didn't make it required until later)
Right now, I have this:
Private Sub txtLayers_BeforeUpdate(Cancel As Integer)
If txtLayers > 0 Then
MsgBox "Number of Layers has been previously created and cannot be changed"
Me.Undo
End If
End Sub
I dont like that the user is not alerted until after they have entered the
new number. I would rather them be able to see that it is not editable once
the number is in there. Any suggestions as to how to do this and/or why the
first code above is not working?
Thanks!
Seren
it. It accepts a number (which is a required field) that is used to determine
how many rows to insert into a table and then display on the next form that
opens. After they are created, when the button on the first form is clicked,
instead of creating new records, it retrieves the ones created the first
time. Therefore, changing this number on the first form will have no effect
on the number of rows created in the table. I want to gray out the text field
*only if/after* the user has entered that number. For some reason, when I
tried
Private Sub txtLayers_AfterUpdate()
' If txtLayers > 0 Then
' ActualSpcWdth.SetFocus
' txtLayers.Enabled = False
' End If
End Sub
it grays out this field on *all* records... even the ones that are either
blank or have 0's. (some were able to be created without entering this field
because I didn't make it required until later)
Right now, I have this:
Private Sub txtLayers_BeforeUpdate(Cancel As Integer)
If txtLayers > 0 Then
MsgBox "Number of Layers has been previously created and cannot be changed"
Me.Undo
End If
End Sub
I dont like that the user is not alerted until after they have entered the
new number. I would rather them be able to see that it is not editable once
the number is in there. Any suggestions as to how to do this and/or why the
first code above is not working?
Thanks!
Seren