I'm pretty new to VB, so don't know what's causing my current issue.
I have successfully created a process to dynamically add field-names and their values to a table by looping through a text file:
For i = 1 To sMax
If i = 1 Then
sFldRpt = "[" & sName(i) & "]"
sValRpt = "'" & sDataRpt(i) & "'"
Else
sFldRpt = sFldRpt & ", [" & sName(i) & "]"
sValRpt = sValRpt & ", '" & sDataRpt(i) & "'"
End If
Next sFieldCount
If there are only 3 columns to update, sName will be:
[Field1], [Field2], [Field3]
and sVal will be:
'123', '456', '789'
Then I use the following command to update the table:
DoCmd.RunSQL "INSERT INTO Results(" & sFldRpt & ") VALUES(" & sValRpt & ");"
This process works so long as I don't have more than 16 entries.
For some reason, with 15 entries, it works fine, but with 16 - only the column names are entered, with no value update.
Can anyone help with this????!!!

I have successfully created a process to dynamically add field-names and their values to a table by looping through a text file:
For i = 1 To sMax
If i = 1 Then
sFldRpt = "[" & sName(i) & "]"
sValRpt = "'" & sDataRpt(i) & "'"
Else
sFldRpt = sFldRpt & ", [" & sName(i) & "]"
sValRpt = sValRpt & ", '" & sDataRpt(i) & "'"
End If
Next sFieldCount
If there are only 3 columns to update, sName will be:
[Field1], [Field2], [Field3]
and sVal will be:
'123', '456', '789'
Then I use the following command to update the table:
DoCmd.RunSQL "INSERT INTO Results(" & sFldRpt & ") VALUES(" & sValRpt & ");"
This process works so long as I don't have more than 16 entries.
For some reason, with 15 entries, it works fine, but with 16 - only the column names are entered, with no value update.
Can anyone help with this????!!!