Connecting Tech Pros Worldwide Help | Site Map

database linking

 
LinkBack Thread Tools Search this Thread
  #1  
Old November 13th, 2005, 12:41 PM
That Guy via AccessMonster.com
Guest
 
Posts: n/a
Default database linking

I am trying to link to tables in a database. I have used the following code,
but I get the following error
Run-time error '-2147467259 (80004005)':

Method 'RecordSet' of Object '_Form_Sales Order Log' failed.

What I am trying to do is while in the form Sales Order Log, but able to
access information in the customerdbnew table. Thanks for any help.

Private Sub ShipmentRequest_Click()

Set Me.Recordset = rstNwind
Dim cnnNwind As New ADODB.Connection
Dim rstNwind As New ADODB.Recordset

With cnnNwind
.Provider = "Microsoft.Jet.OLEDB.4.0"
.Open "\\Backup\hosted files\CustomerDatabase\customerdbnew.mdb",
"admin"
End With

With rstNwind
Set .ActiveConnection = cnnNwind
.CursorType = adOpenKeyset
.CursorLocation = adUseClient
.LockType = adLockOptimistic

End With
Set Me.Recordset = rstNwind


--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200508/1

  #2  
Old November 13th, 2005, 12:41 PM
MGFoster
Guest
 
Posts: n/a
Default Re: database linking

That Guy via AccessMonster.com wrote:[color=blue]
> I am trying to link to tables in a database. I have used the following code,
> but I get the following error
> Run-time error '-2147467259 (80004005)':
>
> Method 'RecordSet' of Object '_Form_Sales Order Log' failed.
>
> What I am trying to do is while in the form Sales Order Log, but able to
> access information in the customerdbnew table. Thanks for any help.
>
> Private Sub ShipmentRequest_Click()
>
> Set Me.Recordset = rstNwind
> Dim cnnNwind As New ADODB.Connection
> Dim rstNwind As New ADODB.Recordset
>[/color]

Remove the Set Me.Recordset = rstNwind in the line before
Dim cnnNwind.... rstNwind isn't defined until the line after Dim
cnnNwind; and, you have the Set command in the correct position - at the
bottom of the Sub routine, anyway.
--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,840 network members.