Using the following code for a form (maybe a report also)

D

David Dubroff

Microsoft Access 2000 Question:

I have a database that stores information for people dropping off cellular
phones for repair at a local business.

I would like some advice as to how I might use the code shown below to
provide useful follow-up statistics.

I am thinking about having some type of form that enables someone to see a
read-only list of individuals who currently have pending repairs. Each row
in the list would represent one pending repair, including the customer's
name, phone number of phone being repaired, serial number of phone being
repaired, and the number of weekdays that have gone by since the phone was
dropped off for repair (skipping saturdays and sundays).

How would I go about creating a read-only list, either as a form or report,
to show the desired information?

Code to calculate the number of weekdays between two dates:

'*********** Code Start **************
Function Work_Days (BegDate As Variant, EndDate As Variant) As Integer
' Note that this function does not account for holidays.
Dim WholeWeeks As Variant
Dim DateCnt As Variant
Dim EndDays As Integer

BegDate = DateValue(BegDate)

EndDate = DateValue(EndDate)
WholeWeeks = DateDiff("w", BegDate, EndDate)
DateCnt = DateAdd("ww", WholeWeeks, BegDate)
EndDays = 0
Do While DateCnt < EndDate
If Format(DateCnt, "ddd") <> "Sun" And _
Format(DateCnt, "ddd") <> "Sat" Then
EndDays = EndDays + 1
End If
DateCnt = DateAdd("d", 1, DateCnt)
Loop
Work_Days = WholeWeeks * 5 + EndDays
End Function
'*********** Code End **************
 
W

William Taylor

use the allowedits property of the form re:
Me.AllowEdits = false
place it in the forms open event
 

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

Top