Link to home
Start Free TrialLog in
Avatar of wmaster1111
wmaster1111

asked on

Referencing records in a table

I have a table (tblHoliday) with a list of dates (34 records).

My form code (based on a different table) uses a For...Next Statement to count the number of weekdays between two selected dates.  An embedded If statement counts only the weekdays.  (Brewdog, if you're reading this it may look familiar).

I don't want to add all weekdays, though.  I need to eliminate the dates listed in tblHoliday.

I am pretty sure I want to embed this in the weekday If statement so that each weekday is compared to the holiday list and not counted if it matches, but I have little idea how to reference the dates in the table.

Thanks in advance,
WM
ASKER CERTIFIED SOLUTION
Avatar of brewdog
brewdog

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of wmaster1111
wmaster1111

ASKER

Thanks!  I tried it out and it seems to work perfectly.  I caught the error in your previous code, but I corrected it in "Case Else" by using "For i=0 to iCheck" (I took out the "-1") and it works fine.  

One thing to note on adding 1 to the inital iCheck definition, as you did in this example, is that you will need to change "Case 0" to "Case 1" and "Case is <0" to "Case is <1".

My VB knowledge is a bit limited, as you can probably tell from my questions.  Do you have any recommendations for any books or websites where I could teach myself more VB at this level (learning the functions like DLookup, DateDiff, and Weekday)?  I already understand the Do loops, Cases, and If statements, so I don't need anything covering that.

Thanks again,
WM
hmm . . . the only book I've used much is the Access Developer's Handbook (I've looked through the 2 and 97 versions, both of which are excellent) published by Sybex. I don't know of any comprehensive source that explains functions, etc. In fact, because of that, I've created my own cheat sheets that I use when I train others in Access. if you're interested, I could send you a list of handouts I have and you could "order" some if you like. :o) They're all free.

If that sounds appealing, just post your e-mail address and I'll send a list.
That would be great.  Please send the list to rparma@edgepet.com .

Thanks again.