Select to view content in your preferred language

Auto populate values in related table - PLEASE HELP!

2277
0
08-14-2011 12:13 PM
MatthewWilson1
Deactivated User
Hello,

I am having some trouble inserting values into a related table in ArcPad 10.  Once an existing facility is selected from the map, I would like to auto populate the related table (DA_FORM) with values from the GIS feature attribute table.  I am not a programmer by any means, so please excuse my ignorance here! 

I can select the appropriate values from the GIS feature, but am having trouble executing the SQL statement.  I get an error on the execute SQL line saying, "the column cannot contain null values. [,,,Column Name, Table Name,]"  Here's what I have so far:

(onformload event)

Sub AutoPop

dim objSelLyr, objSelRS, StrFacilNo, StrStructName

set objSelLyr = Application.Map.SelectionLayer
set objSelRS = objSelLyr.Records

objSelRS.Bookmark = Map.SelectionBookmark

'Get values from structure_existing_area layer
StrFacilNo = objSelRS.Fields("facil_no").Value
StrStructName = objSelRS.Fields("structname").Value

msgbox ("Facility # is " & StrFacilNo & ": " & StrStructName)

Dim DS
Dim SQL
Dim Result

'Set data source
Set DS = objSelLyr.DataSource

'Define SQL statement to insert values into table DA_FORM
SQL = "INSERT INTO DA_FORM (facil_no, facil_type) VALUES ('" & StrFacilNo & "', '" & StrStructName & "')"

'Execute SQL command
Result = DS.Execute(SQL)

End Sub
Tags (3)
0 Kudos
0 Replies