Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here


Problem with Date Picker

Problem with Date Picker

Problem with Date Picker

I have a form which when opened has two text boxes populated from the previous form, e.g





The form has a few other text boxes for data entry by the user and a date picker.

If the user enters the date first the pre-populated text boxes go blank and and re-popualte if data is entered into another text box. I could work round this by disabling the date field until some data has been entered but there must be something wrong in my code but I don't know where to look. I could have been certain this wasn't happening before but only noticed it when reviewing test data and dicovered the blank fields for some of the records in the table

Any suggestions on what would cause this?

RE: Problem with Date Picker

Since these are calculated controls certain form events will cause these to recalculate. Without seeing your code, my guess is that they start to recalculate which causes them to go blank, but they do not finish. You could try add DoEvents in the after update event of the datepicker. You can google doevents, but basically it gives control back to the application allowing cached events to finish.

However, you could avoid this by setting the values in code instead of using calculated control. That is not to say what you are doing is wrong, it is just another way.  So in the form's load event.

me.somecontrol.value = [Forms]![CustomerRecords]![RegNo]
me.someothercontrol.value = DLookUp("FullName","LoginDetailsQuery")

you would have to remove the current control source of the calculated controls.  If it goes blank now, then there has to be some additional code causing it.

RE: Problem with Date Picker

How are ya tamus121 . . .

If the previous form is closed right after the opened form then MajP is correct. Otherwise something else is causing the controls to go blank.

So ... does the previous form remain open?

Your Thoughts? . . .

See Ya! .  .  .  .  .  .

Be sure to see FAQ219-2884: How Do I Get Great Answers To my Tek-Tips Questions?  Worthy Reading! thumbsup2
Also FAQ181-2886: How can I maximize my chances of getting an answer?  Worthy Reading! thumbsup2

RE: Problem with Date Picker

I change the Me.Visisble = False and store the name of the form in a Global variable and then change it back to True when I close Stplabels. I have five of these commands on "CustomerRecords" all operating in the same way and having the same problem.


Private Sub LabelCmd_Click()

On Error GoTo Err_LabelCmd_Click

    Dim stDocName As String

    stDocName = "StpLabels"
    Me.Visible = False
    OpenCloseFrmID = "CustomerRecords"
    DoCmd.OpenForm stDocName
    Exit Sub

    MsgBox Err.Description
    Resume Exit_LabelCmd_Click

End Sub

The only thing I have done differently with this code from previously is add Option Explicit at the top of all my code. I have removed this from the code and tested again but still these go blank.

When the form opens if the user enters details into any of the available fields before entering the date this does not occur.

If the user enters the date first via the date picker the two fields go blank. If the user saves the data at this stage the RegNo. and the Fullnames are not saved - this is understandable as they are used to update two hidden text boxes bound to the table. If the date is entered manually into the text box the details in the two boxes disappears but returns quickly!

If the user enters more data after the date the values then return to the two boxes.

Not sure if this makes sense? Is there some sort of updating going on but with the date picker it doesn't refresh properly?

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close