Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 119
Default Text box value lost

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 C
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Text box value lost

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.

"Steve C" wrote:

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 C

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 119
Default Text box value lost

That's what I was suspecting. I will try your suggestion. Thanks!
--
Steve C


"JLGWhiz" wrote:

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.

"Steve C" wrote:

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 C

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
I lost the box on the top of Excel that you can type text in??? andrew Excel Worksheet Functions 3 April 4th 23 02:28 PM
Japanese text lost when save as tab delimited text file Greg Lovern Excel Programming 0 October 24th 07 08:39 PM
Text Box lost its leading 0 - need help Matt[_33_] Excel Programming 2 November 1st 05 12:58 PM
text cells end page how split to next. Text lost! Elaine Excel Discussion (Misc queries) 1 August 28th 05 05:48 PM
Text in Excel is lost PGP Excel Discussion (Misc queries) 3 June 14th 05 09:22 PM


All times are GMT +1. The time now is 09:14 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"