Solved

Code for Do until Loop

Posted on 2008-06-25
5
791 Views
Last Modified: 2013-11-28
I am trying to write a Do Until loop, what I want to know is how to write the if statement, I want the loop to continue until all 14 check boxes are read. Here is what i think it should be the code below.

Is there a way to have the field Day_ InAMTime etc, read inclemently. There are 14 days that have 4 time fields that need to be populated based on weather the corresponding check box is checked.
\thank you.
If WKDay "& = False Then

Me.Day01InAMTime.Value = tbl_EmployeeData.InAMTime

Me.Day01OutAMTime.Value = tbl_EmployeeData.OutAMTime

Me.Day01InPMTime.Value = tbl_EmployeeData.InPMTime

Me.Day01OutPMTime.Value = tbl_EmployeeData.OutPMTime

Else

Me.Day01InAMTime.Value = Null

Me.Day01OutAMTime.Value = Null

Me.Day01InPMTime.Value = Null

Me.Day01OutPMTime.Value = Null

Open in new window

0
Comment
Question by:life42
  • 3
  • 2
5 Comments
 
LVL 65

Expert Comment

by:Jim Horn
Comment Utility
Give this a whirl... (air code, so modify to suit your needs)

Dim x as Integer

For x = 1 to 14
  Me("Day" & Format(x, "00") & "InAMTime").Value = goo
  Me("Day" & Format(x, "00") & "OutAMTime").Value = foo
  Me("Day" & Format(x, "00") & "InPMTime").Value = boo
  Me("Day" & Format(x, "00") & "OutPMTime").Value = haachoo
next
0
 

Author Comment

by:life42
Comment Utility
Simple question why & Format, and how do I test against the check boxes, in the mean time i will play with this thank you.
0
 
LVL 65

Accepted Solution

by:
Jim Horn earned 500 total points
Comment Utility
>Simple question why & Format
So 1 will be read as 01, 2 as 02, 3 as 03, etc.

>and how do I test against the check boxes,
Not sure what you mean here.
0
 

Author Comment

by:life42
Comment Utility
Do I need to change format and if so to what.
I only want to populate the days that have been checked on another form but that information is stored in the same table that populates the time fields.

0
 

Author Closing Comment

by:life42
Comment Utility
thank you
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now