473,778 Members | 1,764 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Do Until ...... Loop

3 New Member
Hi i am writing a bit of code so that the date and time of a booking can not be booked twice but i am getting an error message saying "loop without do". Any suggestions?

Expand|Select|Wrap|Line Numbers
  1. setflag = False
  2. Do Until EOF(1) Or setflag = True
  3.     If customer.bookingdate <> txtdate Then
  4. GoTo loopend
  5.     If txttimefrom >= customer.timefrom And txttimefrom < customer.timeto Then
  6.     setflag = True
  7. Else
  8. '    'potentially ok'
  9.     If txttimeto > customer.timeto Then
  10.     setflag = True
  11.     End If
  12. End If
  13. Exit Sub
  14. loopend:
  15. Loop
  16. If setflag = True Then
  17. MsgBox ("There is already a booking booked for this time and date. Please choose another time and/or date")
  18. txttimefrom.SetFocus
  19. End If
Cheers in advance, oh and hi everyone :)
Mar 29 '06 #1
3 4946
Hemant Pathak
92 Recognized Expert New Member
Hi............. ... abitlikehomer

Here u see the care fully u are open the 3 if condition and only 2 if Condtion is Closed. then Close all if condition before ending the do loop.
i think it is.

Expand|Select|Wrap|Line Numbers
  1.  setflag = False 
  2. Do Until EOF(1) Or setflag = True
  3. If customer.bookingdate <> txtdate Then
  4. GoTo loopend
  5. endif
  6. If txttimefrom >= customer.timefrom And txttimefrom < customer.timeto Then
  7. setflag = True
  8. Else
  9. ' 'potentially ok'
  10. If txttimeto > customer.timeto Then
  11. setflag = True
  12. End If
  13. End If
  14. Exit Sub
  15. loopend:
  16. Loop
  17. If setflag = True Then
  18. MsgBox ("There is already a booking booked for this time and date. Please choose another time and/or date")
  19. txttimefrom.SetFocus
  20. End If
  21.  
Aug 21 '06 #2
sashi
1,754 Recognized Expert Top Contributor
Hi there,

kindly refer to below attached link for further reading.. take care my fren.. :)
Aug 21 '06 #3
jenna123
1 New Member
Thank you sooo much, I'm a university student and I've been driving myself crazy with the same problem, your solution was perfect. Just know that you saved me from a big headache!
Nov 9 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

8
15684
by: Eric | last post by:
Let me start off by saying I have VB working model which means no help. I have searched MSDN. It seems that I get "Read the help" instead of answers which is totally useless to me. With that said can someone please help me understand why this does not work? Dim x As String Private Sub cmdlogin_Click() Do Until x = "Corey" If txtlogin = "Corey" Then
36
42429
by: Remi Villatel | last post by:
Hi there, There is always a "nice" way to do things in Python but this time I can't find one. What I'm trying to achieve is a conditionnal loop of which the condition test would be done at the end so the loop is executed at least once. It's some way the opposite of "while". So far, all I got is:
4
5836
by: .Net Sports | last post by:
I am trying to display records from a recordset after sql statement: <% sqlstr ="SELECT horsename FROM tblhorseentry WHERE trackname = '" & request.querystring("trackname") & "' and racedate = '" & request.querystring("racedate");" Set rs1 = Server.CreateObject("ADODB.Recordset") rs1.Open sqlstr,pConn,3
2
1794
by: MLH | last post by:
Take a look at the code that follows. Line 110 is the beginning of Do-Loop. Regarding line #220, I find that I'm getting Error #3021 (No Current Record) during execution of line #230. It puzzles me as to Why? I thought if I was on last valid record of RecSet when line #220 executes, I would be sent to process lines after line #400. Am I wrong about that? ==> BEGIN CODE SNIPPET <=== 110 Do Until RecSet.EOF StartAnew:
9
4373
by: deko | last post by:
When doing a mail merge with Word, I can't seem to get the below (abbreviated) routine to iterate strBookmark01 -- it just uses the first name in the recordset for all 10 (or whatever) documents... Is there some other code I need to get the string to iterate with each name? Thanks in advance... Set rstOutput = db.OpenRecordset("qryMailMerge") Do Until rstOutput.EOF strBookmark01 = rstData!Name
4
143999
by: Madhavi | last post by:
Hi Is there any Do Until Loop in C# Maadhavi
7
1483
by: Thomas Nelson | last post by:
Occasionally someone posts to this group complaining about the lack of "repeat ... until" in python. I too have occasionally wished for such a construct, and after some thinking, I came up with the class below. I'm hoping to get some feedback here, and if people besides me think they might use it someday, I can put it on the python cookbook. I'm pretty happy with it, the only ugly thing is you have to use a lambda. Ideally i'd like to...
0
2175
by: Grayzag | last post by:
Hi there, As part of my Software course, i have to create a game. Since I originally started out with python, I was used to it being really easy to create a main loop to control the game with a simple while statement, pausing where input is needed from the user. Now that I have moved on to VB, I can seem to find a way to pause the while statements until the user does something (e.g. clicks a button). When i start my app, if just throws...
2
1476
by: shogot99 | last post by:
Till here the info gotten is ok Loop Until strainfo = "" ScreenMNS.WaitHostQuiet (400) Second process Copy "B" & paste in "E" Range("B2:B600").Select
3
11875
by: SyGC | last post by:
Hi People, Im trying to do a simple Loop where by an IP address is pinged (Using My.computer.network.ping) and the results, true or false, are used to invoke another line of code. Basically if the IP is pingable (true) image A is displayed if it is not (false) then image B is. The code i am using is as follows Dim IPAddress As String = "192.168.1.122"
0
9464
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10292
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10122
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
7471
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5368
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5497
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4031
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3627
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2860
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.