cb_province
province
SELECT tb_province.province_id, tb_province.Province_th FROM tb_province;
Private Sub cb_province_Change()
Me.cb_amphur.Requery
Me.cb_amphur = Null
Me.cb_district = Null
Me.txt_zipcode = Null
End Sub
cb_amphur
amphur
แหล่งข้อมูลแถว
SELECT tb_amphur.amphur_id, tb_amphur.amphur_th FROM tb_province INNER JOIN tb_amphur ON tb_province.province_id=tb_amphur.province_id WHERE (((tb_province.Province_th)=Forms!Form1!cb_province));
เมื่อได้รับการเปลี่ยนแปลง
Private Sub cb_amphur_Change()
Me.cb_district.Requery
Me.cb_district = Null
Me.txt_zipcode = Null
End Sub
เมื่อได้รับการโฟกัส
Private Sub cb_amphur_GotFocus()
Me.cb_amphur.Requery
End Sub
cb_district
district
SELECT tb_district.district_id, tb_district.district_th FROM tb_district INNER JOIN tb_amphur ON tb_district.amphur_id=tb_amphur.amphur_id WHERE (((tb_amphur.amphur_th)=Forms!Form1!cb_amphur));
เมื่อมีการเปลี่ยนแปลง
Private Sub cb_district_Change()
Me.txt_zipcode = DLookup("post_code", "tb_district", "district_th= '" & Me.cb_district & "' AND amphur_id = " & Me.cb_amphur.Column(0, Me.cb_amphur.ListIndex))
' Me.txt_zipcode = DLookup("post_code", "tb_district", "district_th= '" & Me.cb_district & "' AND province_id = " & Me.cb_province.Column(0, Me.cb_province.ListIndex) & " AND amphur_id = " & Me.cb_amphur.Column(0, Me.cb_amphur.ListIndex))
End Sub
เมื่อได้รับการรับการโฟกัส
Private Sub cb_district_GotFocus()
Me.cb_district.Requery
End Sub