activex_data_objects thread: Syntax for setting a forms RecordSource in Access 97 using ADO?
Hello,
I'm trying to find the coorect syntax for setting a forms record source to a
recordset using ADO.
The code keeps hanging on the line "Set Forms("CABLES").Recordset
rstCables" with a Run-time error '2465' - 'Application-defined or object
defined error'.
Below is my code, any help anyone could provide is much appreciated.
Thanks.........Michael
Message = "Enter Hull"
Title = "Hull?"
Default = "CVN 69"
'Display Message, Title, and Default value.
strAPP_HULL = InputBox(Message, Title, Default)
'Prompt for user to enter hull
Message = "Enter Booklet"
Title = "Booklet?"
Default = "6600817"
'Display Message, Title, and Default value.
strBooklet = InputBox(Message, Title, Default)
Set con = New ADODB.Connection
strConn = "Driver={SQL Server};" & _
"Server=C4IDB_DEV;" & _
"Database=IPDBSQL;" & _
"UID=sa;PWD=jerusalem"
con.Open ConnectionString:=strConn
Set rstCables = New ADODB.Recordset
rstCables.CursorLocation = adUseClient
strSQL = "Select * from Cables where APP_HULL='" & strAPP_HULL & "' And
BOOKNUM ='" & strBooklet & "'"
rstCables.Open strSQL, con, adOpenKeyset, adLockOptimistic
Set Forms("CABLES").Recordset = rstCables
Forms("CABLES").UniqueTable = "CABLES