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!

sSQL string -> Table

Status
Not open for further replies.

HansD

Programmer
Feb 12, 2002
60
NL
Hey Everybody

I've got another question:

I have the following string in a searchform.
It puts the results in a Query and it works perfect.

But is it possible to ut the results in a Table (Tbl_Results) instead of a Query.

Thanks
Hans


sSQL = "SELECT [Tbl_Adres_AdresID], [naam], [Bezoekstraat], [BezoekPostcode], [Bezoekplaats], [Poststraat], [PostPostcode], [PostPlaats], [Telefoonnr1], [Telefoonnr2], [Fax], [Mobiel], , [checkEmail], [WebSite], [memo], [Contactpersoon1], [Functie1], [telefoon1], [Email1], [checkEmail1], [Contactpersoon2], [Functie2], [telefoon2], [Email2], [checkEmail2], [Contactpersoon3], [Functie3], [telefoon3], [Email3], [checkEmail3], [Contactpersoon4], [Functie4], [telefoon4], [Email4], [checkEmail4], [Selectiecode1], [Selectiecode2], [Selectiecode3], [Selectiecode4], [Selectiecode5], [Selectiecode6], [Selectiecode7], [Selectiecode8], [Selectiecode9], [Selectiecode10], [Selectiecode11], [Selectiecode12], [Selectiecode13], [Selectiecode14], [Selectiecode15], [Trefwoord]" & _
" FROM Qry_Zoeken" & _
" WHERE " & Criteria & "order by [naam]"

Set db = CurrentDb


On Error Resume Next
db.QueryDefs.Delete "Qry_ZoekResultatenTemp"
On Error GoTo 0

Set QueryDef = db.CreateQueryDef("Qry_ZoekResultatenTemp", sSQL)

If DCount("*", "Qry_ZoekResultatenTemp") > 0 Then

Else
MsgBox "Geen adressen aanwezig met dergelijke zoek criteria"
End If
Set db = Nothing

Forms![Frm_Zoeken]![Frm_Zoekresultaten].Form.RecordSource = "Qry_ZoekResultatenTemp"
Forms![Frm_Zoeken]![Frm_Zoekresultaten].Requery
 
Hi,

To turn your select query into a make table, which would create your table, just change the SQL to:
Code:
SELECT [Tbl_Adres_AdresID], [naam], [Bezoekstraat], [BezoekPostcode], [Bezoekplaats], [Poststraat], [PostPostcode], [PostPlaats], [Telefoonnr1], [Telefoonnr2], [Fax], [Mobiel], [Email], [checkEmail], [WebSite], [memo], [Contactpersoon1], [Functie1], [telefoon1], [Email1], [checkEmail1], [Contactpersoon2], [Functie2], [telefoon2], [Email2], [checkEmail2], [Contactpersoon3], [Functie3], [telefoon3], [Email3], [checkEmail3], [Contactpersoon4], [Functie4], [telefoon4], [Email4], [checkEmail4], [Selectiecode1], [Selectiecode2], [Selectiecode3], [Selectiecode4], [Selectiecode5], [Selectiecode6], [Selectiecode7], [Selectiecode8], [Selectiecode9], [Selectiecode10], [Selectiecode11], [Selectiecode12], [Selectiecode13], [Selectiecode14], [Selectiecode15], [Trefwoord] INTO [TempTable] " & _
   " FROM Qry_Zoeken" & _
        " WHERE " & Criteria & "order by [naam]"

This will create a temporary table that you can do with as you need.

John
 
Tnx for the really fast answer

When i change the string the way you said i get the error:

"The query cannot be used as a rowsource"


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top