Text box value lost

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I've created a form that asks users to input a From: date (txtFrom) and a To:
date (txtTo) for setting a print range. The programming works flawlessly for
3 of the 4 users who use it. However, on the one computer (Kurt) where it
doesn't work, the form doesn't retain the value of the To: text box after
clicking OK. It does retain the value of the From: text box (All users are
using Excel 2003).

I have an error handler that is triggered if the user doesn't enter a To:
date. Part of my code is below. If I step through the code on any of the
other 3 user's computer after entering a To: date of 12/15/07, the
txtTo.Value = "12/15/07". But if I step through it on Kurt's computer, I get
txtTo.Value = "", which then triggers the error handler.

I'm befuddled. I checked Tools > References in the VB Editor on each
computer, and all are the same. Thanks for any ideas you can give me.


Public FromDate As Date, ToDate As Date

Private Sub cmdOK_Click()

frmPrintRange.Hide
FromDate = txtFrom.Value 'today's date automatically entered here upon
loading of form
On Error GoTo ErrorHandler 'if To: date is not entered
ToDate = txtTo.Value

'code that sets print range

ErrorHandler:
MsgBox "No To: date was indicated. Try again.", vbOKOnly, "Error"
Unload Me
Exit Sub
 
Steve, the problem obviously is not in the code. Check Kurt's worksheet for
a Worksheet_Change code that deletes the date entry or sets the cell value to
null. The problem is somewhere in Kurt's system.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top