Instruction Select in sql using vba

radek225

Registered User.
Local time
Today, 13:10
Joined
Apr 4, 2013
Messages
307
In my procedure I want to select content of "status" (text) column where "id_status" (number) = "spr_skrocony_obieg" (variable as long)

How should I write procedure of this case?

Code:
dim strSQL as string
dim spr_skrocony_obieg as long
dim db as DAO.Database
Set db = CurrentDb

spr_skrocony_obieg = 1
strSQL = "SELECT Status from tblStatus WHERE ID_Status[COLOR="Red"]...[/COLOR] "
CurrentDb.Execute strSQL
 
You mean this?
Code:
strSQL = "SELECT status FROM tblStatus WHERE ID_Status = " & spr_skrocony_obieg
 
Except you can't execute a SELECT query. You can open a recordset on that SQL or use DLookup().
 
exactly that's my problem. Why can't I execute a SELECT query? So What should I do, to take value from that and use it in further vba code?
 

Users who are viewing this thread

Back
Top Bottom