By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,027 Members | 1,273 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,027 IT Pros & Developers. It's quick & easy.

disable button if field is empty

P: n/a
hello,

This sounds simple but I can't seem to manage...

So I'm in a form, and have got a button to "open" (make visible) a
subform.
the subform actually contains fields from the same table as the big
form.
but I want the open button to be disabled if a field in the subform is
empty.
But I only seem to be able to disable the button on form_load or other
events.
but how do I check this when I use a search, or when I go to the next
record with the arrows?
cause when I use the arrows, it is no longer a form_load, so if the
button was disabled because the field was empty in the first record,
then how do i "recheck" when I go to another record?.

first I was thinking like:

If IsNull (subform!thefield) Then button.enabled = false Else
button.enabled = true End If

but even here I keep getting an error telling me: object required.
he even doesn't accept the end if sometimes.

I don't seem to find it,
hope you understand ...
thanks in advance,
Olivier

Oct 12 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Hi Oliver,

<ol*************@gmail.comschrieb
first I was thinking like:

If IsNull (subform!thefield) Then button.enabled = false Else
button.enabled = true End If
good thinking.

Put the code into your subform under the "Sub Form_Current()".

Code should be something like that:

If IsNull (subform!thefield) Then
form!thebutton.visible = false
Else
form!thebutton.visible = true
End If

You surely may use "enabled" instead of "visible".

Regards

Michael
Oct 12 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.