Error VB/Form Object Required

ebbo

Registered User.
Local time
Today, 03:34
Joined
Sep 2, 2009
Messages
30
What us wrong with this please? I get error "Object Required"

Code:
Private Sub Form_Open(Cancel As Integer)
If Date_Diarised.Value Is Null Then
Add_Date.Enabled = False
Else
Add_Date.Enabled = True
End If
End Sub

Date_Diarised is field on my form and starts empty, Add_Date is a button that will populate field called Date_Complete with a date. I want the Add_Date field disabled until the user has enter a Date_Diarised. Im very new to this!! tried to seatch but I cant figure it out
 
Last edited:
Private Sub Form_load()
If isnull([Date_Diarised])=true Then
Add_Date.Enabled = False
Else
Add_Date.Enabled = True
End If
End Sub
 
EXCELLENT!!

Now I have modified it.I have two fields, both fields should have a value for the Add_date button to be enabled! The code below works but I have 2 queries below.

Private Sub Form_Open(Cancel As Integer)
If IsNull(Date_Diarised) Or IsNull(User) Then
Add_Date.Enabled = False
Else
Add_Date.Enabled = True
End If
End Sub

1. User is a Combo box...with a bunch of users in the list. And Add_Date is a button that is disabled if either of the two conditions is met. If i fill in both fields (date diarised and user) the Add_Date button does not become enabled until i click out of the current row on the form and then click back in. pretty annoying.... i think its because i placed this in the wrong event......form_open?

How can I get around this?

2. Additionally 1 minor glitch the button is not disabled/enabled for that particular row but all rows on the form! (but the actual function of this still works...e.g if you click in a row with the correct conditions, the button will go enabled and if you click in a row where the conditions are not met the button will go disabled.....it just looks "tacky" that all the buttons should change when only the button for the particular row should....I hope that was a good explanation lol. Right now I have this form working form it just looks a bit amaterish unprofessional

Anyway around this?
 
Last edited:

Users who are viewing this thread

Back
Top Bottom