
Assigning a Dao.Recordset to a Datacontrol With VB6 SP4 and Dao.360
Hi Mauro,
I can not reproduce the problem you described in VB6 sp4. I have tried the
following code and it works as intended.
1. New a VB project.
2. In Form1, put a Data control named Data1 and a CommandButton control
named Command1.
3. Put the following code in the Form1 module. (BIBLIO.MDB is the sample
database shipped with VB6)
Dim Db As Database, Rs As Recordset
Private Sub Command1_Click()
Set Db = Workspaces(0).OpenDatabase("D:\Program Files\Microsoft Visual
Studio\VB98\BIBLIO.MDB")
Set Rs = Db.OpenRecordset("AUTHORS")
Set Data1.Recordset = Rs
Data1.Recordset.Index = "PrimaryKey"
MsgBox Data1.Recordset.Fields(1)
End Sub
After executing the program, when i click Command1 button, it shows the
data as intended.
Can the simple code above run correctly on your machine?
Best Regards,
Elan