Macro to check a box depending on day (1 Viewer)

andymac

Registered User.
Local time
Today, 08:24
Joined
Jun 2, 2013
Messages
36
Hello,

I'm making a very simple flat file database for an event I'll be involved with in a few weeks.

It's a registration form (Name, Contact number, Age) but it also has check boxes to record the attendance of each member (Saturday, Sunday, Monday, Tuesday). Each day a person attends - the respective box is checked.

What is would like, is that whatever day a person registers, it automatically ticks that box. So for example - someone arrives on Monday; I take their details; as soon as I close the form/move to next attribute it automatically checks the attendance box for that day, saving me time.

Hope that makes sense - I can clarify if needs be,

Thanks,

Andrew
 

rzw0wr

I will always be a newbie
Local time
Today, 03:24
Joined
Apr 1, 2012
Messages
489
Try
Code:
Select Case Weekday(Me.Text5, 1) 'Start week on Sunday
    Case 1
        Me.Sun = True
    Case 2
        Me.mon = True
    Case 3
        Me.tue = True
End Select

Dale
 

andymac

Registered User.
Local time
Today, 08:24
Joined
Jun 2, 2013
Messages
36
Hi dale,

Thanks for your swift responce.

As I'm not familiar with code, where in the VBA editor should this go, and in relation to which form element? Does any of it need changed to suit my database (sun, mon, etc).

Andrew
 

rzw0wr

I will always be a newbie
Local time
Today, 03:24
Joined
Apr 1, 2012
Messages
489
What is would like, is that whatever day a person registers, it automatically ticks that box.
This code would go in the AfterUpdate event of the control that selects the Reg date.

SelectMe.Text5 should be replaced with your Date selection control name.
Me.Sun,Me.Mon....
Should be replaced with you check box names.

Continue with the Case to Saturday.
Post back if you run into problems.
Dale
 

andymac

Registered User.
Local time
Today, 08:24
Joined
Jun 2, 2013
Messages
36
Thanks again,

I understand that better now - one thing remains unclear.


SelectMe.Text5 should be replaced with your Date selection control name.

What does this mean?

Thanks
 

rzw0wr

I will always be a newbie
Local time
Today, 03:24
Joined
Apr 1, 2012
Messages
489
It means whatever text box or control you are using to enter a date.

Dale
 

andymac

Registered User.
Local time
Today, 08:24
Joined
Jun 2, 2013
Messages
36
Dale,

Ah yes I see what you mean now. Perhaps I have been slightly misunderstood - there is nowhere in my database where the date will be entered manually.

The reason is that I will be needing to register 100s of people within a very short time, so we're trying to keep input per person to a minimum.

So when someone comes to register (or register their child as the case actually is), we simply take "Child Name," "Contact Number," "Age."

There are then 5 checkboxes - one for each day of the conference (this is ticked every day they attend). I would like however (to save time) the relevant box to be checked for the day they are first registered. So, if someone comes to us new on the first day (saturday) - once I enter their name, number and age, it automatically checks 'saturday' - likewise for someone who perhaps registers for the first time on Monday, or Wednesday.

Sorry for any misunderstanding - I'm not very apt at this whole access thing yet!!

Andrew
 

Users who are viewing this thread

Top Bottom