disgruntled
Registered User.
- Local time
- Today, 17:20
- Joined
- Jul 3, 2001
- Messages
- 38
This is a variation of code borrowed from www.candace_tripp.com and results in cascading combo boxes and an updating subform.it works great except the first time through the line :
Me.sfrmForm.LinkMasterFields = "VEGETATION_CODE"
results in an input box asking for a parameter value for VEGETATION_CODE. No input is ness. just clicking OK and it works great. Any thoughts on how to get rid of the input box. It's not very useful and distarcting to the user.
Much Obliged
Grant
Private Sub cbox_Par_BV_AfterUpdate()
Dim strSQLSF As String
strSQLSF = "SELECT * FROM tblMain_PTREE WHERE tblMain_PTREE.VEGETATION_CODE = '" & cbox_Veg_code & "' AND"
strSQLSF = strSQLSF & " tblMain_PTREE.PARENT_ID = " & cbox_Par_BV & ";"
Me.sfrmForm.LinkChildFields = ""
Me.sfrmForm.LinkMasterFields = ""
Me.sfrmForm.LinkChildFields = "VEGETATION_CODE;PARENT_ID"
Me.sfrmForm.LinkMasterFields = "VEGETATION_CODE;PARENT_ID"
Me.RecordSource = strSQLSF
Me.Requery
End Sub
Private Sub cbox_VEG_CODE_AfterUpdate()
'this code was borrowed from www.cindytripps.com and is used for cascading comboboxes.
Dim strSQL As String
Dim strSQLSF As String
cbox_Par_BV = Null
strSQL = "SELECT DISTINCT tblMain_PTREE.PARENT_ID FROM tblMain_PTREE WHERE tblMain_PTREE.VEGETATION_CODE"
strSQL = strSQL & "= '" & cbox_Veg_code & "' ORDER BY tblMain_PTREE.PARENT_ID;"
cbox_Par_BV.RowSource = strSQL
strSQLSF = "SELECT * FROM tblMain_PTREE WHERE tblMain_PTREE.VEGETATION_CODE = '" & cbox_Veg_code & "';"
Me.sfrmForm.LinkChildFields = ""
Me.sfrmForm.LinkMasterFields = ""
Me.sfrmForm.LinkChildFields = "VEGETATION_CODE"
Me.sfrmForm.LinkMasterFields = "VEGETATION_CODE"
Me.RecordSource = strSQLSF
Me.Requery
End Sub
Private Sub Form_Open(cancel As Integer)
'populate first combobox on form opening
Dim strSQL As String
strSQL = "SELECT DISTINCT tblMain_PTREE.VEGETATION_CODE FROM tblMain_PTREE order by tblMain_PTREE.VEGETATION_CODE;"
cbox_Veg_code.RowSource = strSQL
End Sub
Me.sfrmForm.LinkMasterFields = "VEGETATION_CODE"
results in an input box asking for a parameter value for VEGETATION_CODE. No input is ness. just clicking OK and it works great. Any thoughts on how to get rid of the input box. It's not very useful and distarcting to the user.
Much Obliged
Grant
Private Sub cbox_Par_BV_AfterUpdate()
Dim strSQLSF As String
strSQLSF = "SELECT * FROM tblMain_PTREE WHERE tblMain_PTREE.VEGETATION_CODE = '" & cbox_Veg_code & "' AND"
strSQLSF = strSQLSF & " tblMain_PTREE.PARENT_ID = " & cbox_Par_BV & ";"
Me.sfrmForm.LinkChildFields = ""
Me.sfrmForm.LinkMasterFields = ""
Me.sfrmForm.LinkChildFields = "VEGETATION_CODE;PARENT_ID"
Me.sfrmForm.LinkMasterFields = "VEGETATION_CODE;PARENT_ID"
Me.RecordSource = strSQLSF
Me.Requery
End Sub
Private Sub cbox_VEG_CODE_AfterUpdate()
'this code was borrowed from www.cindytripps.com and is used for cascading comboboxes.
Dim strSQL As String
Dim strSQLSF As String
cbox_Par_BV = Null
strSQL = "SELECT DISTINCT tblMain_PTREE.PARENT_ID FROM tblMain_PTREE WHERE tblMain_PTREE.VEGETATION_CODE"
strSQL = strSQL & "= '" & cbox_Veg_code & "' ORDER BY tblMain_PTREE.PARENT_ID;"
cbox_Par_BV.RowSource = strSQL
strSQLSF = "SELECT * FROM tblMain_PTREE WHERE tblMain_PTREE.VEGETATION_CODE = '" & cbox_Veg_code & "';"
Me.sfrmForm.LinkChildFields = ""
Me.sfrmForm.LinkMasterFields = ""
Me.sfrmForm.LinkChildFields = "VEGETATION_CODE"
Me.sfrmForm.LinkMasterFields = "VEGETATION_CODE"
Me.RecordSource = strSQLSF
Me.Requery
End Sub
Private Sub Form_Open(cancel As Integer)
'populate first combobox on form opening
Dim strSQL As String
strSQL = "SELECT DISTINCT tblMain_PTREE.VEGETATION_CODE FROM tblMain_PTREE order by tblMain_PTREE.VEGETATION_CODE;"
cbox_Veg_code.RowSource = strSQL
End Sub