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!

A SIMPLE COMPARSION SO I THOUGHT! HELP!

Status
Not open for further replies.

Angelique

Technical User
Mar 9, 2001
127
AU
I realise I have been a little more active on the forum than most lately but this form is driving me up the wall.

What is the correct syntax to avoid error 13?

INSERT INTO tblClientSelect (ClientID, DateOfTraining)
SELECT DISTINCTROW [Training Details].ClientID, [Training Details].[Date of Training]
FROM [Training Details]
GROUP BY [Training Details].ClientID, [Training Details].[Date of Training]
HAVING (([Training Details].ClientID AND
[Training Details].[Date of Training] = tblClientSelect.Client AND tblClientSelect.DateOfTraining;

As you can see I want to compare ClientID & Date from the main Training Details table with the ClientID & Date from the tblClientSelect table and if they are the same then do something.

I tried declaring myClient as String and myDate as Date but still got Error 13. I then tried formating myClient as Integer as the ClientID is a number (not text) and formatted the date field as Date but still the error.

I need to resolve this problem before I can even fix my DLookup problem.

Angelique
 
I would suggest that you try the comparisons seperatly, something like

HAVING ([Training Details].ClientID = tblClientSelect.Client) AND
([Training Details].[Date of Training] = tblClientSelect.DateOfTraining);

I hope this helps
 
What am I overlooking? You're not selecting from tblClientSelect so what's the comparison for?

Please explain what you are trying to do. If it is just selecting all distinct ClinetId/DateOfTraining combinations from Training Details and create for each of them a record in tblClientSelect, just skip the entire HAVING part.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top