Information générale
Catégorie:
Bases de données DAO/RDO/ODBC/ADO
Eric,
I tested the code and I was able to bind the fields to the Textboxes.
The problem with the code is that it does not allow me to navigate through the records. So I guess I will need to set the CursorType property of the RecordSet??.
I tested your code with the following modification:
Set cnMyConnection = New Connection
Set recMyRecordSet = New Recordset
Set comMyCommand = New Command
' Establish connection
With cnMyConnection
'.ConnectionString = "Provider=SQLOLEDB;Integrated Security=SSPI;Initial Catalog=OptOut;Data Source=Webdev"
.ConnectionString = "User ID=sa;Provider=SQLOLEDB;Initial Catalog=OptOut;Data Source=Webdev"
.Open
End With
' Create a command object
With comMyCommand
.ActiveConnection = cnMyConnection
.CommandText = "SELECT * FROM OptOut"
' Build the record set
Set recMyRecordSet = comMyCommand.Execute
End With
With Text1
Set .DataSource = recMyRecordSet
.DataField = "last_name"
End With
With Text2
Set .DataSource = recMyRecordSet
.DataField = "first_name"
End With
End Sub
(How do you the change to white the background of the screen when displaying code?)
Thanks,
Sergio
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement