Connecting Tech Pros Worldwide Help | Site Map

database linking

  #1  
Old November 13th, 2005, 01:41 PM
That Guy via AccessMonster.com
Guest
 
Posts: n/a
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, 01:41 PM
MGFoster
Guest
 
Posts: n/a

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)
Closed Thread


Similar Threads
Thread Thread Starter Forum Replies Last Post
Database Linking Soulspike answers 10 January 31st, 2008 11:25 PM
Database Linking (DBF) ekcunha answers 4 September 26th, 2007 09:30 PM
Database linking Bryan via AccessMonster.com answers 1 November 13th, 2005 01:41 PM
DataBase linking Bryan via AccessMonster.com answers 18 November 13th, 2005 01:38 PM
DataBase linking Bryan via AccessMonster.com answers 0 November 13th, 2005 01:38 PM