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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Use passed variables from a subroutine as insert into where criteria

Status
Not open for further replies.

dnamm

Programmer
Jul 16, 2003
8
0
0
US
Hi All,

I'm new at VBA. I'm trying to do an insert statement from a view into an access table. The problem is that I need to use some passed variables from a subroutine as a criteria in the WHERE clause. Could you please show me how to implement it?
ex:

strsql = "insert into tbl_SelectAuths (Authno, authdate, [time], keyword) select authno, authdate, authtime, bno from v_auth_fax where authdate = ad and authtime between ft and tt. The problem is ad, ft, tt, bno is the passing variables from a subroutine. All of the variables were passed (with value) but somehow the data won't insert. No error raised. We tried to qualiying the variables, but it won't insert.

Thank you!
 
If I understand correctly, should be...

strsql = "insert into tbl_SelectAuths (Authno, authdate, [time], keyword) select authno, authdate, authtime, bno from v_auth_fax where authdate = #" & ad & "# AND authtime between #" & ft & "# and
#" & tt & "#"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top