pass thru query & VB problem

T

Tcs

I have a pass thru query which returns my data from our AS400. The parameters
will vary and I believe I've worked out a way to build my statement with the
variable data. So I need to run this from VB. But this isn't the whole
problem.

I also need to be able to use the returned data as input to an append query.
When I hardcoded the parameters into my pass thru query and ran the append
query, Access did just what I wanted it to do. But how do I do this in VB?
(This will be my first time doing this in VB.)

I assume that I have to declare a connection string and open the db, like:

Dim dbODBC As Database, strConnect As String, strSQL As String

strConnect = "ODBC;DSN=" & strLinkDSNname & ";uid=" & strCurrentUser &
";mode=share;dbalias=" & strLinkDSNname & ";trusted_connection=1;;"
Set dbODBC = OpenDatabase("", False, False, strConnect)
DoCmd.SetWarnings False

Then I'll create my SQL statement. Here's the one that I run in Access, my
"front end" (FE) statement.

INSERT INTO tblAcctsRecAging_Details
( CustID,
LocID,
CustClass,
Serv,
PeriodYear,
PeriodMonth,
AgeCode,
ChgType,
ChgDesc,
CurrentAmtBilled,
CurrentUnPaid )

SELECT
qryAcctsRecAging_0010_Current_420_BE.UTCSID,
qryAcctsRecAging_0010_Current_420_BE.UTLCID,
qryAcctsRecAging_0010_Current_420_BE.UTRCLS,
qryAcctsRecAging_0010_Current_420_BE.UTSVC,
qryAcctsRecAging_0010_Current_420_BE.UTPEYY,
qryAcctsRecAging_0010_Current_420_BE.UTPEMM,
qryAcctsRecAging_0010_Current_420_BE.UTAGE,
qryAcctsRecAging_0010_Current_420_BE.UTTTYP,
qryAcctsRecAging_0010_Current_420_BE.UTTDSC,
qryAcctsRecAging_0010_Current_420_BE.UTTAMT,
qryAcctsRecAging_0010_Current_420_BE.UTUNPD

FROM
tblAcctsRecAging_Details RIGHT JOIN qryAcctsRecAging_0010_Current_420_BE ON
tblAcctsRecAging_Details.LocID = qryAcctsRecAging_0010_Current_420_BE.UTLCID;

It's that "qryAcctsRecAging_0010_Current_420_BE" "back end" pass thru query.
How do I modify the above to incorporate the pass thru? Can it be as simple as
"str1SQL" and "str2SQL"? Replacing "qryAcctsRecAging_0010_Current_420_BE" with
my str2SQL string? Could you show me?

Thanks in advance, I really appreciate it.

Tom
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top