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 MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

from Sql DesignView to Code

Status
Not open for further replies.

jammerdk

Technical User
Aug 16, 2001
51
DK
Having this query running on a form ....(Design view Sql)

SELECT [Medarbejder status].TeamNo, [Medarbejder status].MedarbejderID, Attend.AttDate
FROM [Medarbejder status] LEFT JOIN Attend ON [Medarbejder status].MedarbejderID = Attend.AttMedarbejder
WHERE (((Attend.AttType)=1))
GROUP BY [Medarbejder status].TeamNo, [Medarbejder status].MedarbejderID, Attend.AttDate
HAVING (((Attend.AttDate)=[Forms]![frmHovedmenu]![txtDato]));


Would like to run it purely in code.....but can't seem to get to work.


 
You can run this in code, using the RunSQL method, but nothing will 'happen' as it is a select query.

By 'run purely in code', do you mean that the query is built on the fly and not stored anywhere?

If so, you can try building the sql string using code, and either have it make a temp table that can be queried or use the select statement to populate a recordset.

Hope this helps,

ALex

A wise man once said
"The only thing normal about database guys is their tables".
 


Hi,

Where do you supply this FORMS DATE value in your code? It's got to come from somewhere.
Code:
HAVING (((Attend.AttDate)=[Forms]![frmHovedmenu]![txtDato]));



Skip,

[glasses] [red][/red]
[tongue]
 
What do you want to do with the results of your query? You can run your query purely in code, but something has to capture the results - could be a recordset, a control, a table, a file, etc...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top