Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Code for Do until Loop

Posted on 2008-06-25
5
Medium Priority
?
807 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:Jamie Poole
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 66

Expert Comment

by:Jim Horn
ID: 21868626
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:Jamie Poole
ID: 21868672
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 66

Accepted Solution

by:
Jim Horn earned 2000 total points
ID: 21868694
>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:Jamie Poole
ID: 21868720
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:Jamie Poole
ID: 31470699
thank you
0

Featured Post

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
If you need a simple but flexible process for maintaining an audit trail of who created, edited, or deleted data from a table, or multiple tables, and you can do all of your work from within a form, this simple Audit Log will work for you.
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

704 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