Problem with ADO DC RecordSource, SQL query

  • Thread starter Thread starter Frank
  • Start date Start date
F

Frank

I simply can not get the RecordSource to work correctly
when supplying a SQL string to the RecordSource property.
Below I have included the code which gives trouble.

s_sql is a string var with the value:
"SELECT firma.kundenr, firma.fanavn1, firma.adresse1,
firma.postnr, firma.by FROM firma WHERE firma.fanavn1
like 'Ti*' ;"
I have tried this string in an Access query and it works
just fine. However, when I run my program the bound
DataGrid is empty.

If I specify no criteria in my code, s_sql =
"SELECT firma.kundenr, firma.fanavn1, firma.adresse1,
firma.postnr, firma.by FROM firma ;"
This works fine - the DataGrid is populated,

Here is the code:
-----------------------------------
With Adodc_firma
.CommandType = adCmdText
.RecordSource = s_sql
.Refresh
End With
------------------------------------

Is there perhaps some basic element that I have
overlooked? If anyone can give me a hint what could be
wrong, it will be much appreciated.

I have already gotten a suggestion from "Lucky" to use
double quotes instead of '. Unfortunately, it does not
make any difference - I still have an empty DataGrid.


With kind regards,

Frank
 
Back
Top