The problem arise is in the invoice form where i used this coding to retrieve data from my database. In the coding below, the combo1,text is retrived from an invoice table.
VB Code:
Private Sub Form_Load() Set Inv = New Class3 ' The text field and combo text is link to my invoice database Set Text1.DataSource = Inv Text1.DataField = "InvoiceID" Set Text2.DataSource = Inv Text2.DataField = "DateRent" Set Text3.DataSource = Inv Text3.DataField = "DateReturn" Set combo1.DataSource = Inv combo1.DataField = "CustID"
combo1 is the CarRegNO in MS access and is the foreign key in invoice table and also a primary key in car details. The car details in linked 1 - M relations to the invoice table.
VB Code:
Private Sub Combo1_Click() '<--- this combo1 is open from a car details table Call connectDB If Combo1.Text <> "Select Car Reg No" Then sql = "SELECT DISTINCT * FROM CarDetails WHERE CarRegNo='" & Combo1.Text & "'" rs.Open sql, cn, adOpenStatic, adLockOptimistic, adCmdText
The same combo1 text, but they are open in different tables using ADODB connection. How can i form a relationship between them?




Reply With Quote