Klatuu,
You are right, I misspoke. I meant once I've typed into any OTHER field,
the error is resolved (thus creating a new record). But that is actually the
case whether I use the default value or not.
Here is the code including and following the error.
Private Sub Form_Current()
Me.Tenure_Form_Button.Enabled = Me.Frame111 <= 3
End Sub
Private Sub Frame111_AfterUpdate()
Me.Tenure_Form_Button.Enabled = Me.Frame111 <= 3
End Sub
Private Sub Tenure_Form_Button_Click()
On Error GoTo Err_Tenure_Form_Button_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "Tenure Track Form"
stLinkCriteria = "[ID]=" & Me![ID]
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_Tenure_Form_Button_Click:
Exit Sub
Err_Tenure_Form_Button_Click:
MsgBox Err.Description
Resume Exit_Tenure_Form_Button_Click
End Sub
--
Robbin
Klatuu said:
That doesn't seem right. The Default value of a bound control is only
assigned to new records. Anything you enter in the control after the record
has been created will override the default value.
Post the code where the null value error is occuring, please.
--
Dave Hargis, Microsoft Access MVP
:
Thank you, Klatuu. I'm very proud of myself! I actually thought to do that
just after I sent the question, but I'm afraid it doesn't work. Once I type
anything into any field, it activates the default value for the option group.
Problem solved. But by then it's too late.--
Robbin
:
Sounds like the option group is a bound control. Try setting the default
value of the option group to a valid value.
--
Dave Hargis, Microsoft Access MVP
:
Thank you, before I go on, I discovered a problem with the option group
above. When I try to add a new record I get a SQL error - "Invalid Use of
Null". Naturally, it's easily overcome by creating the record, but not very
elegant.
I'll try to compose my other question in a later post.
Thank you again!
--
Robbin
:
Go ahead and post the question. Without some detail, I can't offer a
suggestion.
--
Dave Hargis, Microsoft Access MVP
:
Thank you so much. That worked beautifully. I have another more complex
question about a switch or if statement, but it may be too complicated to
type it all here. Any suggestions?
--
Robbin
:
Use the After Update event of the Option Group
Me.MyButton.Enabled = Me.MyOptionGroup < = 3
If the option group is a bound control, you will also need to put the same
line of code in the form Current event.
--
Dave Hargis, Microsoft Access MVP
:
Hi all,
I hope I'm not duplicating a previous question, but I didn't find it when I
searched.
I have a button on a form that activates a pop-up sub-form. I would like
for the button to remain activated or deactivated (greyed out) based on
option box selections.
Here are the option box selections:
1 Tenured
2 Tenure Approved
3 Tenure Track
4 Non-tenure Track
5 Neither
The option box and the control are on the same form.
I would like the button to be active based on the option box numbers 1, 2,
or 3 and deactive for the rest. If it can't be greyed out, then I guess I
would need a pop-up dialog box telling the user why the button is not active.
Not sure were to set the event or what the code should look like.
Thank you!