R
Roderick O'Regan
I have an Excel file which is a database of names and addresses. It
consists of 16 columns of data and 20 rows for each office.
In my Word template I have a userform with, among other things, a
dropdown list and two command buttons.
One button Retrieves the first nine fields in the database and
displays these on the form for the user to check the correct details
have been selected based on the dropdown list. I have no problems with
this part.
On retrieval, Fields 10 to 16 are put into an array variant, like
this:
VarData(0) = rs.Fields(9).Value
VarData(1) = rs.Fields(10).Value
VarData(2) = rs.Fields(11).Value
VarData(3) = rs.Fields(12).Value
VarData(4) = rs.Fields(13).Value
VarData(5) = rs.Fields(14).Value
VarData(6) = rs.Fields(15).Value
I have checked and each element of the array is holding its correct
information.
What I don't know how to do is to pass the data that was in the array
under the "Retrieve" button so that it can be put on the paper when I
press the "OK" button.
Each piece of the array would be concatenated with a vbCr prior to
going on the page.
Also, if there was no data (Null) in the last field then I would
discard it from the operation.
Can anyone help, please?
Roderick
consists of 16 columns of data and 20 rows for each office.
In my Word template I have a userform with, among other things, a
dropdown list and two command buttons.
One button Retrieves the first nine fields in the database and
displays these on the form for the user to check the correct details
have been selected based on the dropdown list. I have no problems with
this part.
On retrieval, Fields 10 to 16 are put into an array variant, like
this:
VarData(0) = rs.Fields(9).Value
VarData(1) = rs.Fields(10).Value
VarData(2) = rs.Fields(11).Value
VarData(3) = rs.Fields(12).Value
VarData(4) = rs.Fields(13).Value
VarData(5) = rs.Fields(14).Value
VarData(6) = rs.Fields(15).Value
I have checked and each element of the array is holding its correct
information.
What I don't know how to do is to pass the data that was in the array
under the "Retrieve" button so that it can be put on the paper when I
press the "OK" button.
Each piece of the array would be concatenated with a vbCr prior to
going on the page.
Also, if there was no data (Null) in the last field then I would
discard it from the operation.
Can anyone help, please?
Roderick