Query only works w/ original criteria

RaunLGoode

Registered User.
Local time
Today, 07:39
Joined
Feb 18, 2004
Messages
122
I have a select query that creates a list of time charges for each project the employee worked on in a given week. This is used to generate a weekly time sheet.
The query asks the user for the employees ID # and the week ending dateand returns a list of time charges that meet the criteria.

I tested the query and it worked fine on the original employee # and Date.

Next I modified the data in the table that the Query interrogates, (different dates &/or different ID #s) the query doesn't return anything for any new criteria. I am sure I didn't mis-type the criteria and I know the table has been updated with data that should match the criteria. If I change the Data in the Table Back to the criteria in the original Query the update is correct.

This is bound to be a rookie mistake; can somebody out there straighten me out?
 
Employee ID should be the data value of the employee ID, whether it be a string or number, e.g.

"Select * from tbTable where EmployeeID =" & forms!cboEmployeeID (if a number EmployeeID)

"Select * from tbTable where EmployeeID ='" & forms!cboEmployeeID & "'" (if a string employeeID

I'll bet that you use

"Select * from tbTable where EmployeeID = forms!cboEmployeeID"
 
I'm Getting confused,
do I put that statement in the "Criteria" in my Query?
I had been using something like:
[Enter Contractors ID #] in the Criteria for the Employee ID # field and
[Enter Week Ending Date] in the Criteria for the week ending field.

bth
The employee ID # filed is text data type (Alphanumeric w/ no calculations)
and the Week Ending Date is a short date data type
 
The Zipped file had no query.
There are 2 tables (Mainform & Subform)
The re are 3 tables(tbDummy, tbName and tbTimeCharges.
Your building the report from a script in a form and not a Query?
 
The subform recordsource is built (set) when the main form is opened and when the Refresh button is clicked.

That example was to illustrate a method, not an absolute solution to your problem.
 
Is there an advantage to developing this list in a subform rather than using a query?
 
It's just one way to do it.

Without seeing your form, I'm just shooting in the dark.

Is this an assignment for a class? I can show you how to modify a query programmatically, but would again be shooting in the dark.

Show me you form and exactly what your trying to do and I'll help.
 

Users who are viewing this thread

Back
Top Bottom