Sub GetGenusValueDim objForm, objPage, genusValue, genusTextSet objForm = Application.Applets("fillForm").Forms("FORM1")Set objPage = objForm.Pages("PAGE1")genusValue = objPage.Controls("cboGenus").ValuegenusText = objPage.Controls("cboGenus").Text'MsgBox genusValue & " " & genusTextCall GetSpeciesValue(genusValue,objPage)End SubSub GetSpeciesValue(genusValue,objPage)objPage.Controls("cboSpecies").ClearDim objRSSet objRS = Application.CreateAppObject("RecordSet")objRS.Open(preferences.properties("AppletsPath") & "\Species.dbf")objRS.MoveFirstCall objPage.Controls("cboSpecies").AddItemsFromTable(preferences.properties("AppletsPath") & "\Species.dbf", "Species", "Species", ("[GID]= " & genusValue))objRS.CloseEnd Sub
I am new to ArcPAD Studio and have a similar issue. Is it possible you can connect me to discuss. I need to auto fill some fields
Option Explicit
'**********************************************************************************'THIS IS THE VBS FILE FOR "DEPENDENT LISTS"
'Dependent Lists" are lists that display different sets of choices'depending on the value chosen in another list.
'This VBS file needs to be in the same directory as the layer file'**********************************************************************************
Sub LoadDependentList (strTargetComboName, strTableName)
'**********************************************************************************'Procedure: LoadDependentList 'Purpose: Puts a filtered set of list values into a combobox' based on the value of another combobox.'Arguments: strTargetComboName - the name of the combobox to receive the new list' strTableName - the full name of the table containing the "Master" list of values' if its in same directory as edit layer then the path can be omitted' (assumes the table has 3 fields: field1 - the field to filter on;' field2 - the combobox value; field3 - the combobox text)
'**********************************************************************************
Dim rs 'recordset to open the table containing values to go into target comboboxDim strFilter 'the value of the ComboBox that has triggered the OnSelChange eventDim strFieldName 'the name of the field to filter onDim strSearchDim lngFoundDim lngBMDim cboFilterDim pgeDim strValueFieldDim strTextField
If "" & strTableName = "" Then Exit SubEnd If
Set cboFilter=thisevent.objectSet pge=cboFilter.parentstrFilter=cboFilter.value'strFilter=pge.controls("cboFeature").value'msgbox strFilterSet rs=Application.CreateAppObject("recordset")
If instr(strTableName, "\")=0 Then'if the table name does not contain a backslash character then'it does not contain the path to the table, so we assume its in the'same directory as the layer being edited - call the LayerPath function'to get the directory the table is located in strTableName = LayerPath & strTableNameEnd IfOn Error Resume Nexterr.clearrs.open(strTableName)If err.number<>0 Then msgbox "Cannot open Table " & strTableName Set rs=Nothing Set cboFilter=Nothing Set pge=Nothing Exit SubEnd IfstrFieldName=rs.fields.item(1).name'msgbox strFieldName'msgbox LayerPathstrSearch="[" & strFieldName & "]=""" & strFilter & """"strValueField = rs.fields(2).namestrTextField = rs.fields(3).namepge.controls(strTargetComboName).additem "",""pge.controls(strTargetComboName).clear
'record find loop not needed - see AddItemsFromTable method below, with optional filter argument'correction, loop is needed, I'm sick of trying to get the AddItemsFromTable method to work with a filter argumentlngFound=rs.find(strSearch)While lngfound>0 lngBM=rs.bookmark pge.controls(strTargetComboName).additem rs.fields(2),rs.fields(3) lngFound=rs.find(strSearch,,lngBM)Wend'stoprs.close'cant get this to work'pge.controls(strTargetComboName).AddItemsFromTable strTableName, strValueField, strTextField, strSearch
Set rs=NothingSet pge=NothingSet cboFilter=NothingEnd Sub
Function LayerPath'returns the path of the edit layerDim lyrDim strPath
Set lyr=application.map.SelectionLayer '1 is the editable points layerstrPath = lyr.FilePathstrPath=left(strPath,InstrRev(strPath,"\",-1,1))LayerPath=strPath End Function
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.