Here's my pronlem. I have an MSDE database with two tables, tblHeader and tblDetail, a one to many relationship. In my code (posted below) I use an ADODC control. Data is returned, but using the control on the form I have to click the next record arrow as many times as there are detail records to advance 1 record. In other words, if I have 1 header and 2 details, I have to click the next arrow twice to move to the next detail record. The ADODC caption says 4 records are returned in stead of two. I am fairly sure the error is in my join statement, and have tried other join types, but to no avail. Any suggestions?
Code:
Public Sub form_activate()
On Error Resume Next
frmHatsEdit.Width = 14000
frmHatsEdit.Height = 11000
With Adodc2
.ConnectionString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;User ID=sa;Initial Catalog=Products;Data Source=RODKASNICK"
.RecordSource = "SELECT tblHeader.*, tblDetail.* FROM tblHeader inner join tblDetail on tblHeader.preliminary_number = tblDetail.preliminary_number where tblHeader.preliminary_number = '" & hatskey & "' order by tblDetail.comp_number ASC"
.CursorLocation = adUseClient
End With
Adodc2.Refresh
Adodc2.Caption = Adodc2.Recordset.AbsolutePosition & " of " & Adodc2.Recordset.RecordCount
Set Text1.DataSource = Adodc2
Set Text2.DataSource = Adodc2
Set Text3.DataSource = Adodc2
Set Text4.DataSource = Adodc2
Set Text5.DataSource = Adodc2
Text1.DataField = "preliminary_number"
Text2.DataField = "comp_number"
Text3.DataField = "factory_number"
Text4.DataField = "series_vendor"
Text5.DataField = "series_description"
End Sub