picking up null entries.. .not working.. bah! (1 Viewer)

sha7jpm

Registered User.
Local time
Today, 14:46
Joined
Aug 16, 2002
Messages
205
Private Sub Form_Open(Cancel As Integer)
If Me.countdown = Null Then
Me.countdown.Visible = False
Me.countdowntxt.Visible = False
Me.enddate_label.Visible = False
End If

I have this simple code which is if a record has no data in the countdown textbox then the following are not visible..

but it is not working..

any ideas?

I must be making a really stupid error somewhere on this!
I have it in a onopen event..

I also have this in the code and this works perfectly..
If Me.countdown <= 0 Then
Me.countdown.Visible = False
Me.countdowntxt.Visible = False
Me.enddate_label.Visible = True
End If

the countdown textbox is derived from a query that the form is based on..
 

Mile-O

Back once again...
Local time
Today, 14:46
Joined
Dec 10, 2002
Messages
11,316
sha7jpm said:
Private Sub Form_Open(Cancel As Integer)

I have this simple code which is if a record has no data in the countdown textbox then the following are not visible..

The Form_Open event runs before the recordset is loaded into the form. Use the Form_Load event.
 

sha7jpm

Registered User.
Local time
Today, 14:46
Joined
Aug 16, 2002
Messages
205
bah!! again!!

hello to you both, cheers for the ideas...

I tried both of these but still something is wrong...

have zipped up my database..

basically I have a form which depending on the value in txtbox "countdown" the labels on the form appear or not..

the three types are.... less than 0... a blank (null) or a number over 0.

the idea is that it alerts the user as the project gets nearer to the end date... the alert changes depending on the time left...

hope this makes sense...

just cannot get anything to change when I do a if command to pick up the blanks...
also the code I have which picks up minus numbers overrides any code for if countdown is greater than 0....

damnit!

any ideas most gratefully received...

thanks

John
 

Attachments

  • bah.zip
    9.9 KB · Views: 100

IMO

Now Known as ___
Local time
Today, 14:46
Joined
Sep 11, 2002
Messages
723
The form needs to be a single form to get the effect you require.

IMO
 

Attachments

  • bah.zip
    34.1 KB · Views: 98

sha7jpm

Registered User.
Local time
Today, 14:46
Joined
Aug 16, 2002
Messages
205
ta!

cheers IMO..

much appreciated.. can see where I was going wrong!

I really need it in continuous forms... so will try with a recordset.. I assume that is what I need...

will give it a stab and then post back in needbe..

many many thanks

John.
 

sha7jpm

Registered User.
Local time
Today, 14:46
Joined
Aug 16, 2002
Messages
205
hmmmmmm

Ok;; I think this clearly shows I am awful at recordsets.. but have had a stab at it and promptly failed...:mad:

can anyone spread any light on it.. i am trying to achieve the same as above... but in continuous forms layout...

thanks
John

Private Sub Form_Load()
Dim rs As DAO.Recordset
Dim rsexpr1 As Integer
Set rs = CurrentDb.OpenRecordset("dpg alert code 2")

Do While Not rs.EOF
rsexpr1 = rs.Fields("expr1").Value
If IsNull(rsexpr1) Then
Me.countdown.Visible = True
Me.countdowntxt.Visible = False
Me.enddate_label.Visible = False
Else
End If

rs.MoveNext

Loop
Set rs = Nothing

End Sub
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 09:46
Joined
Feb 19, 2002
Messages
43,769
1. The correct event to use when you are toggling visibility based on data is the Current event of the form. The Load event runs only once when the form is loaded and so the form would continue to show or hide based on the initial record. The Current event runs each time a new record is displayed and so the visibility would vary according to each record.

2. You can't do this on a continuous form. A form is a form and only contains a SINGLE set of control properties. Therefore, whatever is set for the properties for the current record will apply to ALL rows. Reading through the recordset doesn't accomplish anything because there is only one place to store the property setting.

Bottom line - search the archives for entries on conditional formatting. I don't think you'll find a solution but you might.
 

sha7jpm

Registered User.
Local time
Today, 14:46
Joined
Aug 16, 2002
Messages
205
barking up the wrong tree!

many thanks Pat..

I'll have a go at the conditional formatting..

thought I would have a stab at the recordset.. (never used one before, so all a worthwhile learning curve)

obviously not useful in this case though!

back to the drawing board!

thanks again

john
 

Users who are viewing this thread

Top Bottom