By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,124 Members | 2,054 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,124 IT Pros & Developers. It's quick & easy.

convert microsoft query into string and Vice versa

P: 4
I need to put some conditions for query so need to save query as string and then want to put it back to its orignal form..
below is the query
Expand|Select|Wrap|Line Numbers
  1. "SELECT ""HPD:HelpDesk"".""Case ID+"", ""HPD:HelpDesk"".Category, ""HPD:HelpDesk"".Type, ""HPD:HelpDesk"".Item, ""HPD:HelpDesk"".""Case Type"", ""HPD:HelpDesk"".Summary, ""HPD:HelpDesk"".Description, ""HPD:HelpDesk"".""Cre" _
  2.         , _
  3.         "ate Time"", ""HPD:HelpDesk"".""Arrival Time"", ""HPD:HelpDesk"".Region, ""HPD:HelpDesk"".Status, ""HPD:HelpDesk"".Pending, ""HPD:HelpDesk"".Priority, ""HPD:HelpDesk"".""Assigned To Group+"", ""HPD:HelpDesk"".""Assigned T" _
  4.         , _
  5.         "o Individual+"", ""HPD:HelpDesk"".""Resolved Time"", ""HPD:HelpDesk"".FirstCallResolution, ""HPD:HelpDesk"".EMI_Department, ""HPD:HelpDesk"".EMI_Operating_Commitee" & Chr(13) & "" & Chr(10) & "FROM ""HPD:HelpDesk"" ""HPD:Hel" _
  6.         , _
  7.         "pDesk""" & Chr(13) & "" & Chr(10) & "WHERE (""HP" _
  8.         , _
  9.         "D:HelpDesk"".Status='Assigned')OR (""HPD:HelpDesk"".Status='Pending') OR (""HPD:HelpDesk"".Status='Work In Progress') AND (""HPD:HelpDesk"".""Case Type""='Incident') And ""HPD:HelpDesk"".EMI_Department='" & Department & "'AND (" _
  10.         , _
  11.         """HPD:HelpDesk"".EMI_Operating_Commitee = '" & OperatingCommitee & "')" _
  12.         )
Please help me!!!
Oct 2 '08 #1
Share this Question
Share on Google+
2 Replies

Expert Mod 2.5K+
P: 2,545
Hi, and Welcome to Bytes!

I have no idea what it is you are really asking here. Your query as you list it seems to consist of a whole series of disconnected key words in string quotes -I've not come across this before at all. Could you explain why it is so disconnected, and what you expect in the way of assistance from us?


Oct 2 '08 #2

Expert 5K+
P: 8,669
  1. I too, like Stewart, am very confused as to what you are exactly asking. If you simply wish to save the SQL of a Query in a String, this is a very simple matter. I'll use a sample Query named qryEmployees for the example:
    Expand|Select|Wrap|Line Numbers
    1. Dim strSQL As String
    2. Dim qdf As DAO.QueryDef
    4. Set qdf = CurrentDb.QueryDefs("qryEmployees")
    6. strSQL = qdf.SQL
    8. Debug.Print strSQL
  2. Debug.Print strSQL yields the following:
    Expand|Select|Wrap|Line Numbers
    1. SELECT Employees.EmployeeID, Employees.LastName, Employees.FirstName, Employees.Title, Employees.TitleOfCourtesy, Employees.BirthDate, Employees.HireDate, Employees.Address, Employees.City, Employees.Region, Employees.PostalCode, Employees.Country, Employees.HomePhone, Employees.Extension, Employees.Photo, Employees.Notes, Employees.ReportsTo, Employees.Married, Employees.[Date Added], Employees.MyMemo, *
    2. FROM Employees
    3. WHERE (((Employees.LastName)="King"));
Oct 2 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.