Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need some help!!!!!!!!!!!!!

Status
Not open for further replies.

jdwm2310

Technical User
Jul 26, 2001
396
US
I have form which has a tab control in the tab there is a combo box for names and date field. The date field is not visible.
In the afterupdate event for the combo box i have this code:
Private Sub Name_AfterUpdate()
Date_Closed.Visible = Now()
End Sub

This will enable the date field to become visible once a name has been selected.

In the on current of the form I insert this code:
Private Sub Form_Current()
Call TabCtl59_AfterUpdate
End Sub

(This is suppose to allow me to add a new record without seeing the date field, meaning that when I move to another record and return the saved record I am able to view the date of the record that is saved)

This is not working what am i doing wrong...I need help this is very important thanks...
 
Date_Closed.Visible = Now()

This will not work as the property will only accept "True" or "False". You should have been made aware of this by Intellisense. As you are typing it will advise you of what are the acceptable values.

Also, your call isn't to the sub you first described. This may have been intentional.

You can also set a breakpoint on the line of code and use the immediate window to try to execute the line.

?Date_Closed.Visible = Now()

This will bypass any error handling and give you an error if it doesn't work.

----------------------
scking@arinc.com
Life is filled with lessons.
We are responsible for the
results of the quizzes.
-----------------------
 
I've noticed a couple of things with your code.

First of all, Date_Closed.Visible = Now() doesn't seem like an appropriate line. Try using True instead.

Secondly, Tab Controls do not have an AfterUpdate event.

In your Form_Current() method try something like this

Private Sub Form_Current()
Date_Closed.Visible = Not IsNull( Name )
End Sub

This should show the date if there is a value in the Name field, and will hide the date if the Name field is null. You may have to change it depending on the default value for the Name field.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top