Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations cowski on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL and MS ACCESS VBA

Status
Not open for further replies.

policky

Industrial
Jul 3, 2009
1
Hi,

i have a little bit trouble with MS ACCESS VBA. I have this code:

DStr = HeldaniFirmy & "*"

Set DBS = CurrentProject.Connection.Execute("SELECT Firma, IC, Mesto, Zeme, TelFa, www, kategorie, popiscinnosti, faxfa, obrat, KompassKod, PocetZamestnancu, Poznámka, Odpov?dná_osoba, Kontaktovat, AktualniKontakt, SoucasnyKlient, MinulyKlient, pase FROM tbl_firmy WHERE ('" & PrenosMest & "' AND Firma = Like " & DStr & ") ORDER BY Firma", , adcmdtext)

But i can not convince VBA to work. Variable DStr (it is string) I want to enter first a few letters and I need the questiun return me every records which start with entered lettes.

Could somebody help me what is wrong and how Can I do it correctly?

Thank you
 
Replies continue below

Recommended for you

what is PrenosMest? The SQL reads something like
Code:
SELECT ... FROM ... WHERE 'xxx' AND Firma = like FRED ORDER BY Firma
Try this to start then add in your PrenoMest bit later
Code:
Set DBS = CurrentProject.Connection.Execute("SELECT Firma, IC, Mesto, Zeme, TelFa, www, kategorie, popiscinnosti, faxfa, obrat, KompassKod, PocetZamestnancu, Poznámka, Odpov?dná_osoba, Kontaktovat, AktualniKontakt, SoucasnyKlient, MinulyKlient, pase FROM tbl_firmy WHERE Firma  Like '" & DStr & "' ORDER BY Firma", , adcmdtext)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor