Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / September 2005

Tip: Looking for answers? Try searching our database.

Error on query open

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
NNlogistics - 08 Sep 2005 15:35 GMT
I have created a report that opens a query to supply totals on the 'On
Format' event of a report footer.
                   Dim Conn As ADODB.Connection
                   Dim rst As ADODB.Recordset
                   Set Conn = New ADODB.Connection
                   Conn.Open CurrentProject.Connection
                   Set rst = New ADODB.Recordset
                   rst.Open "qryTotalRepairHours", Conn, adOpenDynamic,
adLockOptimistic
                   rst.Find "fldRepairedPartNumber = '" &
Me!txtRepairedPartNumber & "'"
                   Me!txtGrandTotal = rst![Grand Total]
                   Me!txtGrandCount = rst![Grand Count]
                   Me!txtCountOffldRepairedPartNumber =
rst![CountOffldRepairedPartNumber]
                   Me!txtTotalUnitRepairCost = rst![SumOffldUnitRepairPrice]
                   rst.Close
                   'Release Table and Connection
                   Set rst = Nothing
                   Set Conn = Nothing

There are actually 2 queries that feed one (qryTotalRepairHours).  Each of
the queries use a date field.  If I criteria the date with 'is notnull' (in
both feeding queries), it works fine and I get all the dates entered.  If I
try to narrow the date by using 'between'(in both feeding queries) it gives
me an error and highlites the open statement.
rst.Open "qryTotalRepairHours", Conn, adOpenDynamic, adLockOptimistic

Any thoughts.

Signature

Thanks for any assistance

pvdalen - 08 Sep 2005 17:57 GMT
It's tough to say without seeing the queries, but in specifying the dates to
be used in the "between" query, did you flank the dates with the # character?

... between #9/1/2005# and #9/5/2005#.....

> I have created a report that opens a query to supply totals on the 'On
> Format' event of a report footer.
[quoted text clipped - 25 lines]
>
> Any thoughts.
NNlogistics - 08 Sep 2005 18:51 GMT
Signature

Thanks for any assistance

> It's tough to say without seeing the queries, but in specifying the dates to
> be used in the "between" query, did you flank the dates with the # character?
[quoted text clipped - 30 lines]
> >
> > Any thoughts.
NNlogistics - 08 Sep 2005 18:59 GMT
Yes I did, I also created a form with a txtbox for starting and ending date
and used

Between [Forms]![frmMenuManagementTools]![txtBeginingDate] And
[Forms]![frmMenuManagementTools]![txtEndingDate]
same problem.
Signature

Thanks for any assistance

> > It's tough to say without seeing the queries, but in specifying the dates to
> > be used in the "between" query, did you flank the dates with the # character?
[quoted text clipped - 30 lines]
> > >
> > > Any thoughts.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.