Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
using a variable in an Access Query
#2
Macro
Code:
Copy      Help
ARRAY(str) a
int r c
DATE d="4/1/2008"

;To create string with variables, use format().
;But variables of type DATE cannot be used with format().
;Convert d to string. To convert, you can simply assign d to a str
;variable (str sd=d). It uses your computer's date format. To make
;sure that date format is like 4/1/2008 on all computers, use time().
str sd.time(d "MM/dd/yyyy")

str sql.format("SELECT ALT FROM Table1 WHERE Date = %s" sd)
;out sql

db2.QueryArr(sql a)
for r 0 a.len(2)
,out "--Record %i--" r+1
,for c 0 a.len(1)
,,out a[c r]


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)