I have two combo box named "cboMPTID" and IPTID" This is what i'm trying to do.
Each time user Picks MotherID from "cboMPTID" they should only see releted records in "CboIPTID"
For example: Mother ID = 100 which has Infant ID = 100-01 and 100-02 so when user pick value 100 from cboMPTID the cboIPTID should only display 100-01 and 100-02. I have wrote this code but i get error massage.
Private Sub cboMPTID_Click()
Dim CON As ADODB.Connection
Dim rs As New ADODB.Recordset
Dim sql As String
Set CON = CurrentProject.Connection
sql = "Select MPTID from tblMother where MotherID = " & cboMPTID.Value
rs.Open sql, CON
Dim i As Integer
For i = 0 To cboIPTID.ListCount - 1
Do While Not rs.EOF