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 / General 2 / May 2008

Tip: Looking for answers? Try searching our database.

dim db as Database

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
lumpy04 - 16 May 2008 18:28 GMT
Hello,

I use an excel sheet to send data to an MS Access table. Basically, I fill
the form out and it sends the data from specific cells to an access database
when I click "submit". It has been working fine for almost a year. Now i get
an error that the database can not be located, and when I open the code the
line "dim db as database" is highlited.  The data base has not moved.

' exports data from the active worksheet to a table in an Access database
'(\\usshl2-dplfsd01\data$\Documentation\PC Build Records.mdb)
' this procedure must be edited before use
Dim db As Database, rs As Recordset, r As Long
   Set db = OpenDatabase("\\usshl2-dplfsd01\data$\Documentation\PC Build
Records.mdb")
   ' open the database
   Set rs = db.OpenRecordset("Build Records", dbOpenTable)
   ' get all records in a table
   'r = 1 ' the start row in the worksheet
   'Do While Len(Range("A" & r).Formula) > 0
   ' repeat until first empty cell in column A
       With rs
           .AddNew ' create a new record
           ' add values to each field in the record
           .Fields("Date of Build") = Range("B1").Value
           .Fields("User Name") = Range("B2").Value
           .Fields("Image Used") = Range("B3").Value
           .Fields("Project") = Range("B4").Value
           .Fields("Operating System") = Range("B5").Value
           .Fields("Device Type") = Range("B6").Value
           .Fields("Service Tag") = Range("B7").Value
           .Fields("warranty") = Range("b8").Value
           ' add more fields if necessary...
           .Update ' stores the new record
       End With
      ' r = r + 1 ' next row
   'Loop
   rs.Close
   Set rs = Nothing
   db.Close
   Set db = Nothing

End Sub

I copied this code from the internet, so don't ask me for an indepth
explanation.

I read som posts about the difference between DAO and ADO libraries, but I
don't know enough to follow up on that.
lumpy04 - 16 May 2008 18:40 GMT
the actual error is: Compile Error: Can't find project or library

> Hello,
>
[quoted text clipped - 44 lines]
>  I read som posts about the difference between DAO and ADO libraries, but I
> don't know enough to follow up on that.
Douglas J. Steele - 16 May 2008 19:34 GMT
It could be a problem with your References collection. These can occur if
you install new software.

Go into the VB Editor and select Tools | References from the menu bar.

Examine all of the selected references (the ones with the check marks at the
top of the list)

If any of the selected references have "MISSING:" in front of them, unselect
them and back out of the dialog (Make sure you write down what the
references were before you delete them, because they'll be in a different
order once they're unselected).

If you need the reference(s) you just unselected (you can tell by doing a
Compile, under the Debug menu), go back in and reselect them.

If none have "MISSING:" in front of them, select an additional reference at
random, back out of the dialog, then go back in and unselect the refernece
you just added. If that doesn't solve the problem, try to unselect as many
of the selected references as you can (Access won't let you unselect them
all), back ouf of the dialog, then go back in and reselect the references
you just unselected.

Signature

Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)

> Hello,
>
[quoted text clipped - 47 lines]
> I read som posts about the difference between DAO and ADO libraries, but I
> don't know enough to follow up on that.
lumpy04 - 16 May 2008 20:56 GMT
THanks Doug. I checked the references and found one missing: Microsoft DAO
3.6 Object Library

I( de-selected like you suggested and backed. Tried to compile he project
and got the same error. I checked the references again and Microsoft DAO 3.6
Object Library is no longer listed as an option.

Can I import this library somehow?

> It could be a problem with your References collection. These can occur if
> you install new software.
[quoted text clipped - 70 lines]
> > I read som posts about the difference between DAO and ADO libraries, but I
> > don't know enough to follow up on that.
Douglas J. Steele - 16 May 2008 22:44 GMT
You shouldn't need to import it. You scrolled through the list and couldn't
find it?

The specific file should be C:\Program Files\Common Files\Microsoft
Shared\DAO\dao360.dll

Assuming it's there, you could try reregistering it using regsvr32.exe. See
http://support.microsoft.com/?kbid=161983 for details.

Signature

Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)

> THanks Doug. I checked the references and found one missing: Microsoft DAO
> 3.6 Object Library
[quoted text clipped - 90 lines]
>> > but I
>> > don't know enough to follow up on that.
lumpy04 - 19 May 2008 14:20 GMT
Thank you!

I ws able to reload the missing DLL using the path you gave me. My
spreadsheet works again!

> You shouldn't need to import it. You scrolled through the list and couldn't
> find it?
[quoted text clipped - 99 lines]
> >> > but I
> >> > don't know enough to follow up on that.
 
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.