LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default Do Loop for Error check

Hi Folks,

In my solution I'm asking for a user to input two parameters that are
strings that I am then passing to an SQL query. Everything works great but I
don't think I am properly or efficiently checking that the parameters are not
either blank or mis formatted. Any suggestions are always greatly appreciated.

' Ask for Data Range Input
dtStartDate = InputBox("Enter a starting date for the report range.",
"Beginning Date Range", "XX/XX/XXXX")
dtEndDate = InputBox("Enter an end date for the report range.", "Ending Date
Range.", "XX/XX/XXXX")

' Check to make sure there has been data entered for the report dates
Do While dtStartDate = ("XX/XX/XXXX")
dtStartDate = InputBox("You must enter a start date for the report
range.", "Beginning Date Range", "XX/XX/XXXX")
Loop
Do While dtStartDate = ("")
dtStartDate = InputBox("You must enter a start date for the report
range.", "Beginning Date Range", "XX/XX/XXXX")
Loop

Do While dtEndDate = ("XX/XX/XXXX")
dtEndDate = InputBox("You must enter an end date for the report range.",
"Ending Date Range", "XX/XX/XXXX")
Loop

Do While dtEndDate = ("")
dtEndDate = InputBox("You must enter an end date for the report range.",
"Ending Date Range", "XX/XX/XXXX")
Loop

Thanks.
 
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
Loop without Do error Steph Excel Programming 2 July 6th 06 07:57 PM
check blocks in loop sybmathics Excel Programming 4 June 3rd 06 04:35 PM
Loop or condition? To check down the rows KH_GS Excel Programming 4 March 29th 06 09:42 AM
Create a Loop to check cells between workbooks No Name Excel Programming 0 September 16th 04 04:35 PM
Befuddled with For Next Loop ------ Run - Time Error '13' Type Mismatch Error rdavis7408 Excel Programming 1 August 25th 04 03:54 AM


All times are GMT +1. The time now is 12:51 PM.

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

About Us

"It's about Microsoft Excel"