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 / November 2006

Tip: Looking for answers? Try searching our database.

Run-Time Error

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Mike - 01 Nov 2006 15:20 GMT
When running a report, i get an error

"Run-time error '-2147352567 (80020009)':  You can't assign a value to this
object."

I have a text field, rptAlloy, and want to fill it with a field from a query
that filled from the form that generates the report...i.e. Form to view
data->click preview/print report->qyr runs->report is generated

here is the code for when the rpt opens up:

Private Sub Report_Open(Cancel As Integer)

Dim C1894db As Database
Dim rst As Recordset

Set C1894 = CurrentDb
Set rst = C1894.OpenRecordset("qryReport")

MsgBox (rst!Alloy)

Me.rptAlloy = rst!Alloy

End Sub

i have the MsgBox as a test, and the MsgBox comes up with the right entry,
however the textbox i want to store the value in won't accecpt the value.

any suggestions?  (i have about 25-30 fields, and i wanted to keep the same
formatting as the form view, so i copied the form, and pasted it in the
report, but then "redrew everything from scratch...)
Stefan Hoffmann - 01 Nov 2006 15:32 GMT
hi Mike,

> Private Sub Report_Open(Cancel As Integer)
>
> Dim C1894db As Database
> Dim rst As Recordset
Better:

Dim C1894db As DAO.Database
Dim rst As DAO.Recordset

> Set C1894 = CurrentDb
The here used variable is undeclared as you declared C1894db (db at the
end).

mfG
--> stefan <--
Mike - 01 Nov 2006 15:47 GMT
I made the changes, and still i get the same thing.

> hi Mike,
>
[quoted text clipped - 13 lines]
> mfG
> --> stefan <--
 
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.