473,545 Members | 2,085 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Run-time error '3011' in select statement in access2002

I had a macro that ran a parameter query and created and opened an
Excel file with the system date as part of the file name, but I had to
change the file name by hand. So I converted the macro to code using
tools-->references.

The converted macro included the following statement:
DoCmd.OutputTo acQuery, "qselLabelsBloo dLog_output",
"MicrosoftExcel Biff8(*.xls)", "S:\susan_chere e\lb041129.xls" , True,
"", 0

I have an input box for the date used in the query and to use in the
excel file name.

Instead of "qselLabelsBloo dLog_output" I put in the SQL statement
variable. Also, I wrote code for an input box and put the SQL query in
as a variable, but the program stops at the DoCmd line with the
following error message:

Run-time error '3011':

The Microsoft Jet database engine could not find the object 'SELECT
qselBsln.FN, qselBsln.LN, tblSelectLabels .PID,
tblSelectLabels .dPossibleDraw AS date_of_Possibl e_Draw,
qmaxTubeId_Pid. MaxOftubeLogid AS DrawId, qselMaxD'. Make sure
the object exists and that you spell its name and the path name
correctly.

Here's my code:
Private Sub cmdOutputPossDr awToExcel_Click ()
Dim db As DAO.Database
Dim rs1 As DAO.Recordset
Dim dPossDraw As Date

'inputbox variables
'++++++++++++++ +++++++++++++++
Dim strResponse As String
Dim strMessage As String
Dim strTitle As String
Dim strDefault, strSql As String
Dim strFileName As String
'++++++++++++++ +++++++++++++++ ++

strMessage = "date of possible draws"
strTitle = "Enter date of possible draws"
strDefault = str(Date)

strResponse = InputBox(strMes sage, strTitle, strDefault)
'capture date from input box as a string year-mon-day
strFileName = Format(strRespo nse, "yyyymmdd")
MsgBox strFileName

'convert input box date to date to use in SQL query
dPossDraw = CDate(strRespon se)

Set db = CurrentDb

strSql = "SELECT qselBsln.FN, qselBsln.LN, tblSelectLabels .PID, "
strSql = strSql & "tblSelectLabel s.dPossibleDraw AS
date_of_Possibl e_Draw, "
strSql = strSql & "qmaxTubeId_Pid .MaxOftubeLogid AS DrawId, "
strSql = strSql & "qselMaxDrawId. MaxOftubeLogid AS MaxDrawID "
strSql = strSql & "FROM qselMaxDrawId, "
strSql = strSql & "(tblSelectLabe ls INNER JOIN qmaxTubeId_Pid ON "
strSql = strSql & "tblSelectLabel s.PID = qmaxTubeId_Pid. pid) INNER
JOIN "
strSql = strSql & "qselBsln ON tblSelectLabels .PID = qselBsln.PID "
strSql = strSql & "WHERE "
strSql = strSql & "(tblSelectLabe ls.dPossibleDra w = #" & dPossDraw &
"# and "
strSql = strSql & "tblSelectLabel s.chkSelectForL abel = Yes) "
strSql = strSql & "ORDER BY qselBsln.LN, tblSelectLabels .PID"

Set rs1 = db.OpenRecordse t(strSql)

DoCmd.OutputTo acOutputQuery, strSql, "MicrosoftExcel Biff8(*.xls)",
"S:\susan_chere e\lb" & strFileName & ".xls", True, "", 0

Set rs1 = Nothing

End Sub

If someone could hlep sort this out, I would appreciate it!

Polly
ca************* ****@hotmail.co m
Nov 13 '05 #1
4 5110
HJ
The object name causes the error. You use a string variable strSQL as the
object name whereas the OutputTo method (in your case) expects the name of
an existing query; see also Access Help.

Therefor you can first redefine an existing query with the composed SQL
string and then use the query name with the OutputTo method:

Dim qd As DAO.QueryDef
Set qd = db.QueryDefs("Y ourQueryName")
qd.SQL = strSQL

Furthermore, you are now not doing anything with the Recordset object. You
may well delete all code referring that object in this procedure.

HJ

"Polly" <ca******@hotma il.com> wrote in message
news:76******** *************** ***@posting.goo gle.com...
I had a macro that ran a parameter query and created and opened an
Excel file with the system date as part of the file name, but I had to
change the file name by hand. So I converted the macro to code using
tools-->references.

The converted macro included the following statement:
DoCmd.OutputTo acQuery, "qselLabelsBloo dLog_output",
"MicrosoftExcel Biff8(*.xls)", "S:\susan_chere e\lb041129.xls" , True,
"", 0

I have an input box for the date used in the query and to use in the
excel file name.

Instead of "qselLabelsBloo dLog_output" I put in the SQL statement
variable. Also, I wrote code for an input box and put the SQL query in
as a variable, but the program stops at the DoCmd line with the
following error message:

Run-time error '3011':

The Microsoft Jet database engine could not find the object 'SELECT
qselBsln.FN, qselBsln.LN, tblSelectLabels .PID,
tblSelectLabels .dPossibleDraw AS date_of_Possibl e_Draw,
qmaxTubeId_Pid. MaxOftubeLogid AS DrawId, qselMaxD'. Make sure
the object exists and that you spell its name and the path name
correctly.

Here's my code:
Private Sub cmdOutputPossDr awToExcel_Click ()
Dim db As DAO.Database
Dim rs1 As DAO.Recordset
Dim dPossDraw As Date

'inputbox variables
'++++++++++++++ +++++++++++++++
Dim strResponse As String
Dim strMessage As String
Dim strTitle As String
Dim strDefault, strSql As String
Dim strFileName As String
'++++++++++++++ +++++++++++++++ ++

strMessage = "date of possible draws"
strTitle = "Enter date of possible draws"
strDefault = str(Date)

strResponse = InputBox(strMes sage, strTitle, strDefault)
'capture date from input box as a string year-mon-day
strFileName = Format(strRespo nse, "yyyymmdd")
MsgBox strFileName

'convert input box date to date to use in SQL query
dPossDraw = CDate(strRespon se)

Set db = CurrentDb

strSql = "SELECT qselBsln.FN, qselBsln.LN, tblSelectLabels .PID, "
strSql = strSql & "tblSelectLabel s.dPossibleDraw AS
date_of_Possibl e_Draw, "
strSql = strSql & "qmaxTubeId_Pid .MaxOftubeLogid AS DrawId, "
strSql = strSql & "qselMaxDrawId. MaxOftubeLogid AS MaxDrawID "
strSql = strSql & "FROM qselMaxDrawId, "
strSql = strSql & "(tblSelectLabe ls INNER JOIN qmaxTubeId_Pid ON "
strSql = strSql & "tblSelectLabel s.PID = qmaxTubeId_Pid. pid) INNER
JOIN "
strSql = strSql & "qselBsln ON tblSelectLabels .PID = qselBsln.PID "
strSql = strSql & "WHERE "
strSql = strSql & "(tblSelectLabe ls.dPossibleDra w = #" & dPossDraw &
"# and "
strSql = strSql & "tblSelectLabel s.chkSelectForL abel = Yes) "
strSql = strSql & "ORDER BY qselBsln.LN, tblSelectLabels .PID"

Set rs1 = db.OpenRecordse t(strSql)

DoCmd.OutputTo acOutputQuery, strSql, "MicrosoftExcel Biff8(*.xls)",
"S:\susan_chere e\lb" & strFileName & ".xls", True, "", 0

Set rs1 = Nothing

End Sub

If someone could hlep sort this out, I would appreciate it!

Polly
ca************* ****@hotmail.co m

Nov 13 '05 #2
Dear HJ,
Thanks for your post.

You clarified what I was afraid was the reason I was getting an error,
the the SQL statemtnt, although it does query the data is not a query
is the query object sense.

If I was not clear, the intention of this procedure was to take a date
from the input box to select records using the SQL statement that
queries the data and use the date in the output file (an excel file)
for other users to access, so they can identify the file for a
particular date. I wanted to manipulate more than is available in a
query.

Is there a way, then, write the data from the SQL statement to Excel?

Polly

"HJ" <hj********@spa mhotmail.com> wrote in message news:<41******* *************** *@news.xs4all.n l>...
The object name causes the error. You use a string variable strSQL as the
object name whereas the OutputTo method (in your case) expects the name of
an existing query; see also Access Help.

Therefor you can first redefine an existing query with the composed SQL
string and then use the query name with the OutputTo method:

Dim qd As DAO.QueryDef
Set qd = db.QueryDefs("Y ourQueryName")
qd.SQL = strSQL

Furthermore, you are now not doing anything with the Recordset object. You
may well delete all code referring that object in this procedure.

HJ

"Polly" <ca******@hotma il.com> wrote in message
news:76******** *************** ***@posting.goo gle.com...
I had a macro that ran a parameter query and created and opened an
Excel file with the system date as part of the file name, but I had to
change the file name by hand. So I converted the macro to code using
tools-->references.

The converted macro included the following statement:
DoCmd.OutputTo acQuery, "qselLabelsBloo dLog_output",
"MicrosoftExcel Biff8(*.xls)", "S:\susan_chere e\lb041129.xls" , True,
"", 0

I have an input box for the date used in the query and to use in the
excel file name.

Instead of "qselLabelsBloo dLog_output" I put in the SQL statement
variable. Also, I wrote code for an input box and put the SQL query in
as a variable, but the program stops at the DoCmd line with the
following error message:

Run-time error '3011':

The Microsoft Jet database engine could not find the object 'SELECT
qselBsln.FN, qselBsln.LN, tblSelectLabels .PID,
tblSelectLabels .dPossibleDraw AS date_of_Possibl e_Draw,
qmaxTubeId_Pid. MaxOftubeLogid AS DrawId, qselMaxD'. Make sure
the object exists and that you spell its name and the path name
correctly.

Here's my code:
Private Sub cmdOutputPossDr awToExcel_Click ()
Dim db As DAO.Database
Dim rs1 As DAO.Recordset
Dim dPossDraw As Date

'inputbox variables
'++++++++++++++ +++++++++++++++
Dim strResponse As String
Dim strMessage As String
Dim strTitle As String
Dim strDefault, strSql As String
Dim strFileName As String
'++++++++++++++ +++++++++++++++ ++

strMessage = "date of possible draws"
strTitle = "Enter date of possible draws"
strDefault = str(Date)

strResponse = InputBox(strMes sage, strTitle, strDefault)
'capture date from input box as a string year-mon-day
strFileName = Format(strRespo nse, "yyyymmdd")
MsgBox strFileName

'convert input box date to date to use in SQL query
dPossDraw = CDate(strRespon se)

Set db = CurrentDb

strSql = "SELECT qselBsln.FN, qselBsln.LN, tblSelectLabels .PID, "
strSql = strSql & "tblSelectLabel s.dPossibleDraw AS
date_of_Possibl e_Draw, "
strSql = strSql & "qmaxTubeId_Pid .MaxOftubeLogid AS DrawId, "
strSql = strSql & "qselMaxDrawId. MaxOftubeLogid AS MaxDrawID "
strSql = strSql & "FROM qselMaxDrawId, "
strSql = strSql & "(tblSelectLabe ls INNER JOIN qmaxTubeId_Pid ON "
strSql = strSql & "tblSelectLabel s.PID = qmaxTubeId_Pid. pid) INNER
JOIN "
strSql = strSql & "qselBsln ON tblSelectLabels .PID = qselBsln.PID "
strSql = strSql & "WHERE "
strSql = strSql & "(tblSelectLabe ls.dPossibleDra w = #" & dPossDraw &
"# and "
strSql = strSql & "tblSelectLabel s.chkSelectForL abel = Yes) "
strSql = strSql & "ORDER BY qselBsln.LN, tblSelectLabels .PID"

Set rs1 = db.OpenRecordse t(strSql)

DoCmd.OutputTo acOutputQuery, strSql, "MicrosoftExcel Biff8(*.xls)",
"S:\susan_chere e\lb" & strFileName & ".xls", True, "", 0

Set rs1 = Nothing

End Sub

If someone could hlep sort this out, I would appreciate it!

Polly
ca************* ****@hotmail.co m

Nov 13 '05 #3
UPDATE
Dear HJ,
Since you pretty much confirmed that I needed to have an actual query,
I found some examples in the newsgroup file. I ended up using
transferspreads heet. In order to do this, I had to have an actual
query. I used CreateQueryDef, then
did the transferspreads heet.

Here's my new code:

Private Sub cmdOutputPossDr awToExcel_Click ()

MsgBox "in process"
Dim db As DAO.Database

Dim qdfTemp As DAO.QueryDef
Dim qdfnew As DAO.QueryDef

Dim dPossDraw As Date

'inputbox variables
'++++++++++++++ +++++++++++++++
Dim strResponse As String
Dim strMessage As String
Dim strTitle As String
Dim strDefault, strSql As String
Dim strFileName As String
'++++++++++++++ +++++++++++++++ ++

strMessage = "date of possible draws"
strTitle = "Enter date of possible draws"
strDefault = str(Date)

strResponse = InputBox(strMes sage, strTitle, strDefault)
'capture date from input box as a string year-mon-day
strFileName = Format(strRespo nse, "yymmdd")
MsgBox strFileName

'convert input box date to date to use in SQL query
dPossDraw = CDate(strRespon se)

Set db = CurrentDb

'create permanent query to reference later
Set qdfnew = db.CreateQueryD ef("NewQueryDef ", _
"SELECT qselBsln.FN,
qselBsln.LN,tbl SelectLabels.PI D,tblSelectLabe ls.dPossibleDra w AS
date_of_Possibl e_Draw,qmaxTube Id_Pid.MaxOftub eLogid AS
DrawId,qselMaxD rawId.MaxOftube Logid AS MaxDrawID FROM
qselMaxDrawId,( tblSelectLabels INNER JOIN qmaxTubeId_Pid ON
tblSelectLabels .PID = qmaxTubeId_Pid. pid) INNER JOIN qselBsln ON
tblSelectLabels .PID = qselBsln.PID WHERE
(tblSelectLabel s.dPossibleDraw = #" & dPossDraw & "# and
tblSelectLabels .chkSelectForLa bel = Yes) ORDER BY qselBsln.LN,
tblSelectLabels .PID")

'create excel file of possible draws using new query definition
DoCmd.TransferS preadsheet acExport, acSpreadsheetTy peExcel9,
"newqueryde f", "S:\susan_chere e\lb" & strFileName & ".xls", True, "",
0

'delete newly created query
db.QueryDefs.De lete qdfnew.NAME

MsgBox "done"
End Sub

Thanks, HJ!

Polly
ca******@hotmai l.com (Polly) wrote in message news:<76******* *************** ***@posting.goo gle.com>...
Dear HJ,
Thanks for your post.

You clarified what I was afraid was the reason I was getting an error,
the the SQL statemtnt, although it does query the data is not a query
is the query object sense.

If I was not clear, the intention of this procedure was to take a date
from the input box to select records using the SQL statement that
queries the data and use the date in the output file (an excel file)
for other users to access, so they can identify the file for a
particular date. I wanted to manipulate more than is available in a
query.

Is there a way, then, write the data from the SQL statement to Excel?

Polly

"HJ" <hj********@spa mhotmail.com> wrote in message news:<41******* *************** *@news.xs4all.n l>...
The object name causes the error. You use a string variable strSQL as the
object name whereas the OutputTo method (in your case) expects the name of
an existing query; see also Access Help.

Therefor you can first redefine an existing query with the composed SQL
string and then use the query name with the OutputTo method:

Dim qd As DAO.QueryDef
Set qd = db.QueryDefs("Y ourQueryName")
qd.SQL = strSQL

Furthermore, you are now not doing anything with the Recordset object. You
may well delete all code referring that object in this procedure.

HJ

"Polly" <ca******@hotma il.com> wrote in message
news:76******** *************** ***@posting.goo gle.com...
I had a macro that ran a parameter query and created and opened an
Excel file with the system date as part of the file name, but I had to
change the file name by hand. So I converted the macro to code using
tools-->references.

The converted macro included the following statement:
DoCmd.OutputTo acQuery, "qselLabelsBloo dLog_output",
"MicrosoftExcel Biff8(*.xls)", "S:\susan_chere e\lb041129.xls" , True,
"", 0

I have an input box for the date used in the query and to use in the
excel file name.

Instead of "qselLabelsBloo dLog_output" I put in the SQL statement
variable. Also, I wrote code for an input box and put the SQL query in
as a variable, but the program stops at the DoCmd line with the
following error message:

Run-time error '3011':

The Microsoft Jet database engine could not find the object 'SELECT
qselBsln.FN, qselBsln.LN, tblSelectLabels .PID,
tblSelectLabels .dPossibleDraw AS date_of_Possibl e_Draw,
qmaxTubeId_Pid. MaxOftubeLogid AS DrawId, qselMaxD'. Make sure
the object exists and that you spell its name and the path name
correctly.

Here's my code:
Private Sub cmdOutputPossDr awToExcel_Click ()
Dim db As DAO.Database
Dim rs1 As DAO.Recordset
Dim dPossDraw As Date

'inputbox variables
'++++++++++++++ +++++++++++++++
Dim strResponse As String
Dim strMessage As String
Dim strTitle As String
Dim strDefault, strSql As String
Dim strFileName As String
'++++++++++++++ +++++++++++++++ ++

strMessage = "date of possible draws"
strTitle = "Enter date of possible draws"
strDefault = str(Date)

strResponse = InputBox(strMes sage, strTitle, strDefault)
'capture date from input box as a string year-mon-day
strFileName = Format(strRespo nse, "yyyymmdd")
MsgBox strFileName

'convert input box date to date to use in SQL query
dPossDraw = CDate(strRespon se)

Set db = CurrentDb

strSql = "SELECT qselBsln.FN, qselBsln.LN, tblSelectLabels .PID, "
strSql = strSql & "tblSelectLabel s.dPossibleDraw AS
date_of_Possibl e_Draw, "
strSql = strSql & "qmaxTubeId_Pid .MaxOftubeLogid AS DrawId, "
strSql = strSql & "qselMaxDrawId. MaxOftubeLogid AS MaxDrawID "
strSql = strSql & "FROM qselMaxDrawId, "
strSql = strSql & "(tblSelectLabe ls INNER JOIN qmaxTubeId_Pid ON "
strSql = strSql & "tblSelectLabel s.PID = qmaxTubeId_Pid. pid) INNER
JOIN "
strSql = strSql & "qselBsln ON tblSelectLabels .PID = qselBsln.PID "
strSql = strSql & "WHERE "
strSql = strSql & "(tblSelectLabe ls.dPossibleDra w = #" & dPossDraw &
"# and "
strSql = strSql & "tblSelectLabel s.chkSelectForL abel = Yes) "
strSql = strSql & "ORDER BY qselBsln.LN, tblSelectLabels .PID"

Set rs1 = db.OpenRecordse t(strSql)

DoCmd.OutputTo acOutputQuery, strSql, "MicrosoftExcel Biff8(*.xls)",
"S:\susan_chere e\lb" & strFileName & ".xls", True, "", 0

Set rs1 = Nothing

End Sub

If someone could hlep sort this out, I would appreciate it!

Polly
ca************* ****@hotmail.co m

Nov 13 '05 #4
HJ
You're welcome. I see that you use the date variable dPossDraw in your SQL
statement. That may lead to unexpected results if the date does not get
formatted correctly. For more information see
http://www.mvps.org/access/datetime/date0005.htm

HJ

"Polly" <ca******@hotma il.com> wrote in message
news:76******** *************** ***@posting.goo gle.com...
UPDATE
Dear HJ,
Since you pretty much confirmed that I needed to have an actual query,
I found some examples in the newsgroup file. I ended up using
transferspreads heet. In order to do this, I had to have an actual
query. I used CreateQueryDef, then
did the transferspreads heet.

Here's my new code:

Private Sub cmdOutputPossDr awToExcel_Click ()

MsgBox "in process"
Dim db As DAO.Database

Dim qdfTemp As DAO.QueryDef
Dim qdfnew As DAO.QueryDef

Dim dPossDraw As Date

'inputbox variables
'++++++++++++++ +++++++++++++++
Dim strResponse As String
Dim strMessage As String
Dim strTitle As String
Dim strDefault, strSql As String
Dim strFileName As String
'++++++++++++++ +++++++++++++++ ++

strMessage = "date of possible draws"
strTitle = "Enter date of possible draws"
strDefault = str(Date)

strResponse = InputBox(strMes sage, strTitle, strDefault)
'capture date from input box as a string year-mon-day
strFileName = Format(strRespo nse, "yymmdd")
MsgBox strFileName

'convert input box date to date to use in SQL query
dPossDraw = CDate(strRespon se)

Set db = CurrentDb

'create permanent query to reference later
Set qdfnew = db.CreateQueryD ef("NewQueryDef ", _
"SELECT qselBsln.FN,
qselBsln.LN,tbl SelectLabels.PI D,tblSelectLabe ls.dPossibleDra w AS
date_of_Possibl e_Draw,qmaxTube Id_Pid.MaxOftub eLogid AS
DrawId,qselMaxD rawId.MaxOftube Logid AS MaxDrawID FROM
qselMaxDrawId,( tblSelectLabels INNER JOIN qmaxTubeId_Pid ON
tblSelectLabels .PID = qmaxTubeId_Pid. pid) INNER JOIN qselBsln ON
tblSelectLabels .PID = qselBsln.PID WHERE
(tblSelectLabel s.dPossibleDraw = #" & dPossDraw & "# and
tblSelectLabels .chkSelectForLa bel = Yes) ORDER BY qselBsln.LN,
tblSelectLabels .PID")

'create excel file of possible draws using new query definition
DoCmd.TransferS preadsheet acExport, acSpreadsheetTy peExcel9,
"newqueryde f", "S:\susan_chere e\lb" & strFileName & ".xls", True, "",
0

'delete newly created query
db.QueryDefs.De lete qdfnew.NAME

MsgBox "done"
End Sub

Thanks, HJ!

Polly
ca******@hotmai l.com (Polly) wrote in message

news:<76******* *************** ***@posting.goo gle.com>...
Dear HJ,
Thanks for your post.

You clarified what I was afraid was the reason I was getting an error,
the the SQL statemtnt, although it does query the data is not a query
is the query object sense.

If I was not clear, the intention of this procedure was to take a date
from the input box to select records using the SQL statement that
queries the data and use the date in the output file (an excel file)
for other users to access, so they can identify the file for a
particular date. I wanted to manipulate more than is available in a
query.

Is there a way, then, write the data from the SQL statement to Excel?

Polly

"HJ" <hj********@spa mhotmail.com> wrote in message news:<41******* *************** *@news.xs4all.n l>...
The object name causes the error. You use a string variable strSQL as the object name whereas the OutputTo method (in your case) expects the name of an existing query; see also Access Help.

Therefor you can first redefine an existing query with the composed SQL string and then use the query name with the OutputTo method:

Dim qd As DAO.QueryDef
Set qd = db.QueryDefs("Y ourQueryName")
qd.SQL = strSQL

Furthermore, you are now not doing anything with the Recordset object. You may well delete all code referring that object in this procedure.

HJ

"Polly" <ca******@hotma il.com> wrote in message
news:76******** *************** ***@posting.goo gle.com...
> I had a macro that ran a parameter query and created and opened an
> Excel file with the system date as part of the file name, but I had to > change the file name by hand. So I converted the macro to code using
> tools-->references.
>
> The converted macro included the following statement:
> DoCmd.OutputTo acQuery, "qselLabelsBloo dLog_output",
> "MicrosoftExcel Biff8(*.xls)", "S:\susan_chere e\lb041129.xls" , True,
> "", 0
>
> I have an input box for the date used in the query and to use in the
> excel file name.
>
> Instead of "qselLabelsBloo dLog_output" I put in the SQL statement
> variable. Also, I wrote code for an input box and put the SQL query in > as a variable, but the program stops at the DoCmd line with the
> following error message:
>
> Run-time error '3011':
>
> The Microsoft Jet database engine could not find the object 'SELECT > qselBsln.FN, qselBsln.LN, tblSelectLabels .PID,
> tblSelectLabels .dPossibleDraw AS date_of_Possibl e_Draw,
> qmaxTubeId_Pid. MaxOftubeLogid AS DrawId, qselMaxD'. Make sure
> the object exists and that you spell its name and the path name
> correctly.
>
> Here's my code:
> Private Sub cmdOutputPossDr awToExcel_Click ()
> Dim db As DAO.Database
> Dim rs1 As DAO.Recordset
> Dim dPossDraw As Date
>
> 'inputbox variables
> '++++++++++++++ +++++++++++++++
> Dim strResponse As String
> Dim strMessage As String
> Dim strTitle As String
> Dim strDefault, strSql As String
> Dim strFileName As String
> '++++++++++++++ +++++++++++++++ ++
>
> strMessage = "date of possible draws"
> strTitle = "Enter date of possible draws"
> strDefault = str(Date)
>
> strResponse = InputBox(strMes sage, strTitle, strDefault)
> 'capture date from input box as a string year-mon-day
> strFileName = Format(strRespo nse, "yyyymmdd")
> MsgBox strFileName
>
> 'convert input box date to date to use in SQL query
> dPossDraw = CDate(strRespon se)
>
> Set db = CurrentDb
>
> strSql = "SELECT qselBsln.FN, qselBsln.LN, tblSelectLabels .PID, "
> strSql = strSql & "tblSelectLabel s.dPossibleDraw AS
> date_of_Possibl e_Draw, "
> strSql = strSql & "qmaxTubeId_Pid .MaxOftubeLogid AS DrawId, "
> strSql = strSql & "qselMaxDrawId. MaxOftubeLogid AS MaxDrawID "
> strSql = strSql & "FROM qselMaxDrawId, "
> strSql = strSql & "(tblSelectLabe ls INNER JOIN qmaxTubeId_Pid ON "
> strSql = strSql & "tblSelectLabel s.PID = qmaxTubeId_Pid. pid) INNER
> JOIN "
> strSql = strSql & "qselBsln ON tblSelectLabels .PID = qselBsln.PID "
> strSql = strSql & "WHERE "
> strSql = strSql & "(tblSelectLabe ls.dPossibleDra w = #" & dPossDraw &
> "# and "
> strSql = strSql & "tblSelectLabel s.chkSelectForL abel = Yes) "
> strSql = strSql & "ORDER BY qselBsln.LN, tblSelectLabels .PID"
>
> Set rs1 = db.OpenRecordse t(strSql)
>
> DoCmd.OutputTo acOutputQuery, strSql, "MicrosoftExcel Biff8(*.xls)",
> "S:\susan_chere e\lb" & strFileName & ".xls", True, "", 0
>
> Set rs1 = Nothing
>
> End Sub
>
> If someone could hlep sort this out, I would appreciate it!
>
> Polly
> ca************* ****@hotmail.co m

Nov 13 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
4917
by: leroybt.rm | last post by:
Can someone tell me how to run a script from a interactive shell I type the following: >>>python filename >>>python filename.py >>>run filename >>>run filename.py >>>/run filename >>>/run filename.py
4
3206
by: Ed | last post by:
Hello, I took a course in asp about 2 years ago and I was practicing with IIS 5.0. Then I put it down for a while. Now trying to get back to it. I can't run asp files from subdirectories of my root directory, but I can run asp files from the root directory of my website and I can run htm files from the subdirectories. If I run ...
6
20045
by: orekin | last post by:
Hi There I have been trying to come to grips with Application.Run(), Application.Exit() and the Message Pump and I would really appreciate some feedback on the following questions .. There are quite a few words in this post but the questions are actually quite similar and should be fairly quick to answer ... (1) What is Happening with...
13
5058
by: Bob Day | last post by:
Using vs2003, vb.net I start a thread, giving it a name before start. Code snippet: 'give each thread a unique name (for later identification) Trunk_Thread.Name = "Trunk_0_Thread" ' allow only 1 thread per line Trunk_Thread.ApartmentState = ApartmentState.STA
19
2205
by: Bryan | last post by:
How can i run a bit of code straight from the IDE? Right now i make a temporary button and put the code behind that, then i run debug mode and click on the button. Is there a way to highlight some code and tell it to run that? Is there a "scratchpad" type window like in VBA where I can write some simple code to be executed? Thanks for the...
9
4661
by: Brett Wesoloski | last post by:
I am new to VS2005. I changed my program.cs file to be a different form I am working on. But when I go to run the application it still brings up the form that was originally declared as new. When I put in a break point the program does not stop. It is in debug mode. If I change the program.cs file back to the form that was originally...
7
2932
by: Lee Crabtree | last post by:
I remember when I was first getting into .NET Forms programming that there was a rather emphatic rule about not constructing a form before calling Application.Run with it. So this: Application.Run(new Form1()); was okay, but this: Form1 form = new Form1();
8
3001
by: David Thielen | last post by:
Hi; In our setup program how do I determine if I need to run "aspnet_regiis –i" and if so, is there an API I can calll rather than finding that program on the user's disk and calling it? -- thanks - dave david_at_windward_dot_net http://www.windwardreports.com
3
11273
by: traceable1 | last post by:
Is there a way I can set up a SQL script to run when the instance starts up? SQL Server 2005 SP2 thanks!
7
11732
by: mxdevit | last post by:
Task: run application from ASP.NET for example, you have a button on ASP.NET page, when press this button - one application is invoked. the code to run application (for example, notepad) is (on C#) System.Diagnostics.Process.Start("notepad");
0
7401
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7808
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7423
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
5972
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5329
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
4945
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3450
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3443
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
704
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.