All,
This is an Urgent request for help and all help would be appreciated.
I have a variable table that is created upon user input and then they have their own data that they will be passing to this table. I capture the data and variable tablenames into 2 seperate arrays.
PND(50) = Field Data
PNF(50) = Field Name
I need to find a way to put the Value of PND into the Field of PNF that had a table customly created for it.
For example:
The process created a table "X" with the field name of "CustomerName". Later on, on a different form I have the array's which capture "Joe Blow" in PND(1) with PNF(1) equaling "CustomerName". How do I get the 2 arrays to send the data into the table named "X" ?
Here's what I've been trying...
rstII = openrecordset for table X yada,yada....
jx = integer loop for array
jy = recordcount -1
fld = field
flds = rstII.fields
strfn = string
rstII.AddNew
For jx = 1 To jy - 1
For Each FLD In FLDS
If FLD.Name = PNF(jx) Then
Debug.Print FLD.Name
strfn = FLD.Name
rstII.Fields(strfn).Value = PND(jx)
End If
Next
Next
rstII.Update
I know that the proper syntax would be...
with rstII
.addnew
!customername = "Joe Blow"
.update
end with
However, Since the FieldName "[customername]" is also a variable... It will not accept the above as the process will not read the field name as a variable string type of "PNF(1)".
TIA,
Mike
This is an Urgent request for help and all help would be appreciated.
I have a variable table that is created upon user input and then they have their own data that they will be passing to this table. I capture the data and variable tablenames into 2 seperate arrays.
PND(50) = Field Data
PNF(50) = Field Name
I need to find a way to put the Value of PND into the Field of PNF that had a table customly created for it.
For example:
The process created a table "X" with the field name of "CustomerName". Later on, on a different form I have the array's which capture "Joe Blow" in PND(1) with PNF(1) equaling "CustomerName". How do I get the 2 arrays to send the data into the table named "X" ?
Here's what I've been trying...
rstII = openrecordset for table X yada,yada....
jx = integer loop for array
jy = recordcount -1
fld = field
flds = rstII.fields
strfn = string
rstII.AddNew
For jx = 1 To jy - 1
For Each FLD In FLDS
If FLD.Name = PNF(jx) Then
Debug.Print FLD.Name
strfn = FLD.Name
rstII.Fields(strfn).Value = PND(jx)
End If
Next
Next
rstII.Update
I know that the proper syntax would be...
with rstII
.addnew
!customername = "Joe Blow"
.update
end with
However, Since the FieldName "[customername]" is also a variable... It will not accept the above as the process will not read the field name as a variable string type of "PNF(1)".
TIA,
Mike