Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I really need help on this Query

Status
Not open for further replies.

rry2k

Programmer
Jun 28, 2001
678
US
I have a query that runs correctly but when I run a form with this query as the source I get no records. The query prompts me for the forms_timecardID and then Forms_combowkend which is a date. I have a feeling that it's not interpreting the comparison correctly when I enter on the form. I checked the combobox for isdate and it is. The field in the table is a shortdate. This might be where the problem lies but I can't get a handle on it.

Query:
SELECT DISTINCTROW Time Card Hours.*, [Time Card Hours].[BillingRate]*[BillableHours] AS [Hourly Billings]
FROM [Time Cards] INNER JOIN [Time Card Hours] ON [Time Cards].[TimeCardID]=[Time Card Hours].[TimeCardID]
WHERE [Time Cards].[TimeCardID]=[Forms]![TimeCardsNew]![TimeCardID] And [time card hours].[Weekending]=[forms]![TimeCardsnew]![combowkend];


I really appreciate the help..Russ
 
Well, first isolate where the problem is... Try to hard-code a date into the Where condition. Next, if that is not the problem, remove the Where condition entirely. Build the query little by little.

U may need to issue a format clause on the field or use the "#" symbols...

i.e.: lcWhere = lcWhere & &quot; AND &quot; & &quot;(CourseStartDate <= #&quot; & Me.txtEnddate.VALUE & &quot;#)&quot;

htwh Steve Medvid
&quot;IT Consultant & Web Master&quot;
 
I suggest - print to Immediate window teh compunded query string, then copy it to new query (SQL view) nad try to run. This trick have helped me a lot of times to find out problems in genearting dynamic SQL-statements.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top