calculation form

daneo2k3

Registered User.
Local time
Today, 10:59
Joined
Nov 27, 2003
Messages
81
hi i have got a form which allows users to choose an employee they want to see choose 2 dates to view and then a calculate button which calculates the amount they worked between the two days and produces a report on this. so far this works but only with the date that is in on default 01/11/03 to 30/11/03 when you try to change these dates it comes up with a msg box saying :
run-time error '3464':
Data type mismatch in criteria expression

and when i click debug it brings this line up:

ElseIf DCount("Employee", "qryTimeWorked") = 0 Then

can anybody help???
 
That ElseIf DCount statement has no date criteria in it. You can use a single DCount formula that has the two dates as criteria. Please post the rest of your code.
 
Option Compare Database
Option Explicit

Private Sub cmdCalc_Click()
If IsNull(Me.cboEmployees) Then
MsgBox "You must select an employee.", vbExclamation, "Example"
ElseIf DCount("Employee", "qryTimeWorked") = 0 Then
MsgBox "No records were found.", vbExclamation, "Example"
Else
DoCmd.OpenReport "rptTimeWorked", acViewPreview
End If
End Sub
 
What's happening in the qryTimeWorked query? Any calculations? Or is it just feeding the data into your form?
 
there was a calculation of the hours worked times rates of pay put i removed that because i dont have an hours work field now as the employees work on a a daily rate
 

Attachments

Users who are viewing this thread

Back
Top Bottom