Hello All,
The title of the thread should be pretty self-explanatory. I have
an Access 2003 ADP project with unbound forms. I need to bind the
stored procedure to my form, using ADO, which I'm really not
familiar with (much better with DAO). I already have several
examples of bound forms in the db I'm working with using DAO and
I'm trying to move towards a much more client-server model.
The stored procedure itself is a very simple select statement
using one of the tables in the SQL server db:
I've had a go at the ado code and so far have got the following,
which I'm sure is full of holes.
Can someone help me take this a little further?
Thanks very much for any help!
The title of the thread should be pretty self-explanatory. I have
an Access 2003 ADP project with unbound forms. I need to bind the
stored procedure to my form, using ADO, which I'm really not
familiar with (much better with DAO). I already have several
examples of bound forms in the db I'm working with using DAO and
I'm trying to move towards a much more client-server model.
The stored procedure itself is a very simple select statement
using one of the tables in the SQL server db:
Code:
SELECT surname, forename, dob,
addr1, addr2, postcode
FROM tblpatients
which I'm sure is full of holes.
Can someone help me take this a little further?
Thanks very much for any help!
Code:
Public Sub OpenFormSP()
Dim objCmd As ADODB.Command
Dim rst As ADODB.Recordset
Dim strRecordset As String
'Call EstablishConnection
Set objCmd = New ADODB.Command
'objConn.CursorLocation = adUseClient
With objCmd
.CommandText = "SPGetPatient"
.CommandType = adCmdStoredProc
'What here????
End With
If rst.RecordCount > 0 Then 'there are rows returned
Set strRecordset = rst
Forms!frmTestSP.Recordset = strRecordset
End If
Set rst = Nothing
End Sub