how to select a date and use the day as information?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

i am using the active x calander and when i select a date say a monday i want
a massage to appear to say that i can only take 5 patients on a monday and so
on for tuesday etc. this is because i run different clinics on different days
each with a differnet ammount of patients that can be taken. i have been
trying a few different ways and the only thing i can think of that will work
is to make a table with the date of each monday, tuesday etc for the next
year or however long but it just wouldnt be fesiable.

any help would be great thanks
 
David,

Bulit-in function Weekday() is your friend! Look it up in Access help.

HTH,
Nikos
 
Davi,

Try this:

If Weekday(AptDate, vbMonday) = vbMonday Then
MsgBox "didah didah"
Else
'whatever
End If

where I have assumed AptDate to hold the appointment date. If the number
of max appointments varies per day of week, you could use something like:

Dim vMaxApts As Integer
Dim vDay As Long

Select Case Weekday(AptDate, vbMonday)
Case vbMonday
vMaxApts = 5
vDay = "Monday"
Case vbTuesday
vMaxApts = 8
vDay = "Tuesday"
Case vbWednesday
vMaxApts = 4
vDay = "Wednesday"
Case vbThursday
vMaxApts = 5
vDay = "Thursday"
Case vbFriday
vMaxApts = 6
vDay = "Friday"
Case Else
MsgBox AptDate & " is not a working day!", vbExclamation, "Error!"
Exit Sub '(or Exit Function)
End Select

MsgBox "You can only take " & vMaxApts & " on a " & vDay & "!"

HTH,
Nikos
 
i tryed the code:

If Weekday(AptDate, vbMonday) = vbMonday Then
MsgBox "didah didah"

but it doesnt understand the AptDate variable do i need to declare it before
hand?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top