Connecting Tech Pros Worldwide Help | Site Map

database linking

That Guy via AccessMonster.com
Guest
 
Posts: n/a
#1: Nov 13 '05
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
MGFoster
Guest
 
Posts: n/a
#2: Nov 13 '05

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 Microsoft Access / VBA bytes