Parameters from VB6 to ACCESS VBA SQL-statement 
Author Message
 Parameters from VB6 to ACCESS VBA SQL-statement

Hi!

Anyone knows about this subject?
I have a working VBA-application in ACCESS97.
I use SQL-statements like (some names in Swedish sorry for the
inconvenience):
SELECT Lastlogg.ID, Lastlogg.Datum, Lastlogg.Tid, Lastlogg.Volym,
Lastlogg.Ppm, Lastlogg.Temp, Lastlogg.NormVolym,.....
.......Lastlogg.Sign
FROM Lastlogg
WHERE ((Lastlogg.Datum Between [Forms]![Maintain]![txtDatumFrom] And
[Forms]![Maintain]![txtDatumTo] AND (Lastlogg.Datum
<>[Forms]![Maintain]![txtDatumTo])));
I have a Form in ACCESS called Maintain and to fields handling date from
and to txtDatumFrom and txtDatumTo this is working very well.
I using VB6 with Microsoft Access 8.0 Object Library today also
accessing the same database
with function like in VB6 thats working fine like:
 DoCmd.TransferDatabase acExport, "Microsoft Access", Path, acTable,
"SQL-statement", "Lastlogg"

Ho do I passing the two DATE-parameters to the SQL-statement reside in
the ACCESS database?
SQL-statements without parameter already working very well!
Could I initiate the Form Maintain in ACCESS or someone have a more
esasy solution to the problem??

Thanks in advance

Bj?rn Axelsson



Mon, 25 Nov 2002 03:00:00 GMT  
 Parameters from VB6 to ACCESS VBA SQL-statement
Hi!

Anyone knows about this subject?
I have a working VBA-application in ACCESS97.
I use SQL-statements like (some names in Swedish sorry for the
inconvenience):
SELECT Lastlogg.ID, Lastlogg.Datum, Lastlogg.Tid, Lastlogg.Volym,
Lastlogg.Ppm, Lastlogg.Temp, Lastlogg.NormVolym,.....
.......Lastlogg.Sign
FROM Lastlogg
WHERE ((Lastlogg.Datum Between [Forms]![Maintain]![txtDatumFrom] And
[Forms]![Maintain]![txtDatumTo] AND (Lastlogg.Datum
<>[Forms]![Maintain]![txtDatumTo])));
I have a Form in ACCESS called Maintain and to fields handling date from
and to txtDatumFrom and txtDatumTo this is working very well.
I using VB6 with Microsoft Access 8.0 Object Library today also
accessing the same database
with function like in VB6 thats working fine like:
 DoCmd.TransferDatabase acExport, "Microsoft Access", Path, acTable,
"SQL-statement", "Lastlogg"

Ho do I passing the two DATE-parameters to the SQL-statement reside in
the ACCESS database?
SQL-statements without parameter already working very well!
Could I initiate the Form Maintain in ACCESS or someone have a more
esasy solution to the problem??

Thanks in advance

Bj?rn Axelsson



Mon, 25 Nov 2002 03:00:00 GMT  
 Parameters from VB6 to ACCESS VBA SQL-statement
Forgot to mention that when you change the SQL you would want to insert the
current value where your parameter would go.
For example, If you want it to search a date range you would do this:
Select * from MyTable Where MyDate Between #1/1/1999# and #1/1/2000#
or when using variables something like this
"Select * from MyTable Where MyDate Between #" & dFirstDate & "# And #" &
dLastDate & "#"

hope that helps...

Quote:

> I don't think there's a really easy way of passing your parameters like
> that.  What you can do though is change the SQL property of your query.  You
> would do something like this:

> Dim qdf as QueryDef

> Set qdf = CurrentDB.QueryDefs("MyQueryName")
> qdf.SQL = "Select ....."
> qdf.close

> then just export that query
> (If someone knows of a better way, please enlighten us.)

> Becky


> > Hi!

> > Anyone knows about this subject?
> > I have a working VBA-application in ACCESS97.
> > I use SQL-statements like (some names in Swedish sorry for the
> > inconvenience):
> > SELECT Lastlogg.ID, Lastlogg.Datum, Lastlogg.Tid, Lastlogg.Volym,
> > Lastlogg.Ppm, Lastlogg.Temp, Lastlogg.NormVolym,.....
> > .......Lastlogg.Sign
> > FROM Lastlogg
> > WHERE ((Lastlogg.Datum Between [Forms]![Maintain]![txtDatumFrom] And
> > [Forms]![Maintain]![txtDatumTo] AND (Lastlogg.Datum
> > <>[Forms]![Maintain]![txtDatumTo])));
> > I have a Form in ACCESS called Maintain and to fields handling date from
> > and to txtDatumFrom and txtDatumTo this is working very well.
> > I using VB6 with Microsoft Access 8.0 Object Library today also
> > accessing the same database
> > with function like in VB6 thats working fine like:
> >  DoCmd.TransferDatabase acExport, "Microsoft Access", Path, acTable,
> > "SQL-statement", "Lastlogg"

> > Ho do I passing the two DATE-parameters to the SQL-statement reside in
> > the ACCESS database?
> > SQL-statements without parameter already working very well!
> > Could I initiate the Form Maintain in ACCESS or someone have a more
> > esasy solution to the problem??

> > Thanks in advance

> > Bj?rn Axelsson




Mon, 25 Nov 2002 03:00:00 GMT  
 Parameters from VB6 to ACCESS VBA SQL-statement
I was looking at one of the thread on 6/8/00.

WHATS FASTER?

Jim has suitable reply for you. I liked the following link. Its' so
easy.

http://dansville.nscnet.net/sparkys/daoqueryhelp.html

Rana



Quote:
> Hi!

> Anyone knows about this subject?
> I have a working VBA-application in ACCESS97.
> I use SQL-statements like (some names in Swedish sorry for the
> inconvenience):
> SELECT Lastlogg.ID, Lastlogg.Datum, Lastlogg.Tid, Lastlogg.Volym,
> Lastlogg.Ppm, Lastlogg.Temp, Lastlogg.NormVolym,.....
> .......Lastlogg.Sign
> FROM Lastlogg
> WHERE ((Lastlogg.Datum Between [Forms]![Maintain]![txtDatumFrom] And
> [Forms]![Maintain]![txtDatumTo] AND (Lastlogg.Datum
> <>[Forms]![Maintain]![txtDatumTo])));
> I have a Form in ACCESS called Maintain and to fields handling date
from
> and to txtDatumFrom and txtDatumTo this is working very well.
> I using VB6 with Microsoft Access 8.0 Object Library today also
> accessing the same database
> with function like in VB6 thats working fine like:
>  DoCmd.TransferDatabase acExport, "Microsoft Access", Path, acTable,
> "SQL-statement", "Lastlogg"

> Ho do I passing the two DATE-parameters to the SQL-statement reside in
> the ACCESS database?
> SQL-statements without parameter already working very well!
> Could I initiate the Form Maintain in ACCESS or someone have a more
> esasy solution to the problem??

> Thanks in advance

> Bj?rn Axelsson


Sent via Deja.com http://www.deja.com/
Before you buy.


Mon, 25 Nov 2002 03:00:00 GMT  
 Parameters from VB6 to ACCESS VBA SQL-statement
I don't think there's a really easy way of passing your parameters like
that.  What you can do though is change the SQL property of your query.  You
would do something like this:

Dim qdf as QueryDef

Set qdf = CurrentDB.QueryDefs("MyQueryName")
qdf.SQL = "Select ....."
qdf.close

then just export that query
(If someone knows of a better way, please enlighten us.)

Becky

Quote:

> Hi!

> Anyone knows about this subject?
> I have a working VBA-application in ACCESS97.
> I use SQL-statements like (some names in Swedish sorry for the
> inconvenience):
> SELECT Lastlogg.ID, Lastlogg.Datum, Lastlogg.Tid, Lastlogg.Volym,
> Lastlogg.Ppm, Lastlogg.Temp, Lastlogg.NormVolym,.....
> .......Lastlogg.Sign
> FROM Lastlogg
> WHERE ((Lastlogg.Datum Between [Forms]![Maintain]![txtDatumFrom] And
> [Forms]![Maintain]![txtDatumTo] AND (Lastlogg.Datum
> <>[Forms]![Maintain]![txtDatumTo])));
> I have a Form in ACCESS called Maintain and to fields handling date from
> and to txtDatumFrom and txtDatumTo this is working very well.
> I using VB6 with Microsoft Access 8.0 Object Library today also
> accessing the same database
> with function like in VB6 thats working fine like:
>  DoCmd.TransferDatabase acExport, "Microsoft Access", Path, acTable,
> "SQL-statement", "Lastlogg"

> Ho do I passing the two DATE-parameters to the SQL-statement reside in
> the ACCESS database?
> SQL-statements without parameter already working very well!
> Could I initiate the Form Maintain in ACCESS or someone have a more
> esasy solution to the problem??

> Thanks in advance

> Bj?rn Axelsson




Mon, 25 Nov 2002 03:00:00 GMT  
 Parameters from VB6 to ACCESS VBA SQL-statement
You could do that, but it would take much longer.   And then how would you
export the table?  It would be a round about way and involve more code than
changing the query's SQL property.
Quote:

> I was looking at one of the thread on 6/8/00.

> WHATS FASTER?

> Jim has suitable reply for you. I liked the following link. Its' so
> easy.

> http://dansville.nscnet.net/sparkys/daoqueryhelp.html

> Rana



> > Hi!

> > Anyone knows about this subject?
> > I have a working VBA-application in ACCESS97.
> > I use SQL-statements like (some names in Swedish sorry for the
> > inconvenience):
> > SELECT Lastlogg.ID, Lastlogg.Datum, Lastlogg.Tid, Lastlogg.Volym,
> > Lastlogg.Ppm, Lastlogg.Temp, Lastlogg.NormVolym,.....
> > .......Lastlogg.Sign
> > FROM Lastlogg
> > WHERE ((Lastlogg.Datum Between [Forms]![Maintain]![txtDatumFrom] And
> > [Forms]![Maintain]![txtDatumTo] AND (Lastlogg.Datum
> > <>[Forms]![Maintain]![txtDatumTo])));
> > I have a Form in ACCESS called Maintain and to fields handling date
> from
> > and to txtDatumFrom and txtDatumTo this is working very well.
> > I using VB6 with Microsoft Access 8.0 Object Library today also
> > accessing the same database
> > with function like in VB6 thats working fine like:
> >  DoCmd.TransferDatabase acExport, "Microsoft Access", Path, acTable,
> > "SQL-statement", "Lastlogg"

> > Ho do I passing the two DATE-parameters to the SQL-statement reside in
> > the ACCESS database?
> > SQL-statements without parameter already working very well!
> > Could I initiate the Form Maintain in ACCESS or someone have a more
> > esasy solution to the problem??

> > Thanks in advance

> > Bj?rn Axelsson

> Sent via Deja.com http://www.deja.com/
> Before you buy.



Mon, 25 Nov 2002 03:00:00 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. VB6 - Problem passing multiple parameters to Command SQL statement

2. Access: Err 2342 in SQL SELECT Statement in VBA

3. Access: Err 2342 in SQL SELECT Statement in VBA

4. VBA in Access ... sql statement with querydef

5. SQL statement and Access via VB6

6. problems with sql statement using access 2000, ado, vb6

7. SQL statement generates Parameter Required box

8. Query parameters list and SQL statement

9. strange parameter error in SQL statement

10. Parameter in WHERE clause in VB SQL statement

11. SQL Statement and parameters

12. sql statement _ parameter

 

 
Powered by phpBB® Forum Software