|
Enquiry About Project
Rory, below are the latest coding tht modify. Does this coding correct? Can u check for me? Can it work? Anything else that need to add?
Private Sub cmdDelete_Click()
datCheckin.DatabaseName = App.Path & "\db.mdb"
sSql = "select * from checkin"
datCheckin.RecordSource = sSql
datCheckin.Refresh
datCheckout.DatabaseName = App.Path & "\db.mdb"
sSql1 = "select * from checkout"
datCheckout.RecordSource = sSql1
datCheckout.Refresh
datRoom.DatabaseName = App.Path & "\db.mdb"
sSql2 = "select * from room"
datRoom.RecordSource = sSql2
datRoom.Refresh
datDaily.DatabaseName = App.Path & "\db.mdb"
sSql3 = "select * from daily"
datDaily.RecordSource = sSql3
datDaily.Refresh
End Sub
Public Function CanRecordBeDeleted(ByVal strRecordDate As String) As Boolean
' Inputs: A string date
' Outputs: True or false
' True: Date occurs in last month or prior
' False: Date occurs this month or later
'
Dim datRecordDate As Date
' Used to hold the date in "VB" form
Dim datStartOfMonth As Date
' Date rolled back to the start of the month
Dim TodayStartOfMonth As Date
' Today rolled back to the start of the month
datRecordDate = CDate(strRecordDate)
datStartOfMonth = VBA.DatePart("m", datRecordDate)
TodayStartOfMonth = VBA.DatePart("m", VBA.Now())
' This built in VB function rounds down to the start of the month
If datStartOfMonth < TodayStartOfMonth Then
CanRecordBeDeleted = True
Else
CanRecordBeDeleted = False
End If
MsgBox("Do you really want to clear all the shift records ?", vbExclamation + vbYesNo, "DELETE ALERT") = vbYes
End Function
Last edited by kbkhoo5053; Feb 11th, 2005 at 9:29 PM.
|