|
|
|
| Помогите разобраться: делаю подчиненную таблицу
'настраиваю Adodc:
Set adPlaysD = AdodcPlays.Object
adPlaysD.ConnectionString = "Provider=MSDataShape.1;Persist Security Info=False;Data Source=C:\Databases\db12.mdb;Data Provider=Microsoft.Jet.OLEDB.4.0"
adPlaysD.CommandType = adCmdUnknown
adPlaysD.RecordSource = "SHAPE {select PlaysID, ComandIDHost, ComandIDGuest, PlaysDate from Plays} AS ParentCMD APPEND ({select PlaysID, ComandID, PlayerID, TimedPlayed, PlayRate, PlaySum from PlaysDetails} AS ChildCMD RELATE PlaysID TO PlaysID) AS ChildCMD"
'настравиваю таблицу
Set grd = DataGrid1.Object
Set grd.DataSource = adPlaysD.Recordset("ChildCMD").UnderlyingValue -- Ошибка Object variable not set | |
|
| |
|
|
|
| Разобрался - кажется:
Dim cn As ADODB.Connection
Dim rs2 As ADODB.Recordset
Set cn = New ADODB.Connection
cn.ConnectionString = "PROVIDER=MSDataShape;Data PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Databases\db12.MDB;"
cn.Open
Set rs2 = New ADODB.Recordset
rs2.Source = rs.Source
rs2.ActiveConnection = cn
rs2.CursorType = adOpenKeyset
rs2.LockType = adLockOptimistic
rs2.Open
Set grid1 = DataGrid1.Object
Set grid1.DataSource = rs2("ChildCMD").UnderlyingValue
grid1.AllowAddNew = True
grid1.AllowArrows = True
grid1.Columns(0).Button = True
grid1.Columns(0).Locked = False
grid1.TabAction = dbgColumnNavigation | |
|
| |