Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 814
  • Last Modified:

Code for Do until Loop

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
Jamie Poole
Asked:
Jamie Poole
  • 3
  • 2
1 Solution
 
Jim HornMicrosoft SQL Server Developer, Architect, and AuthorCommented:
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
 
Jamie PooleDigital Specialist Author Commented:
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
 
Jim HornMicrosoft SQL Server Developer, Architect, and AuthorCommented:
>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
 
Jamie PooleDigital Specialist Author Commented:
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
 
Jamie PooleDigital Specialist Author Commented:
thank you
0

Featured Post

Transaction-level recovery for Oracle database

Veeam Explore for Oracle delivers low RTOs and RPOs with agentless transaction log backup and transaction-level recovery of Oracle databases. You can restore the database to a precise point in time, even to a specific transaction.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now