AccessVBAUser
New member
- Local time
- Today, 13:56
- Joined
- Feb 13, 2009
- Messages
- 3
Hello,
I have been given a list of names in excel. I have imported those names into a table in access named Employee. So the table, column and names look like:
Table: Employee
Column: Employee
Row1 Todd
Row2 Mike
Row3 Sarah
I need to take this table and turn it into a table (like a matrix in theory) that has each distinct combination of names and without having two of the same (ie Todd cant be in column1 and column2). For example:
Column1 Column2
Todd Mike
Todd Sarah
Sarah Mike
The code i had started is as followed:
Dim empArray(rst.RecordCount, rst.RecordCount) As String
'SET RECORDSET 1
strSql = "Select Employee from Employee"
Set rst = dbs.OpenRecordset(strSql)
'SET RECORDSET 2
strSql2 = "Select Employee from Employee"
Set rst2 = dbs.OpenRecordset(strSql2)
rst.MoveFirst
rst2.MoveFirst
Do Until rst2.EOF
Do Until rst.EOF
empArray = (rst2.GetRows(1, y) , (rst1.GetRows(1, x))
rst.MoveNext
Set x = x + 1
Loop
rst.MoveFirst
rst2.MoveNext
Set y = y + 1
Loop
Any help would be greatly appreciated. I have been tasked with getting this done ASAP and am not very experienced working in this realm. Thank you so much.
I have been given a list of names in excel. I have imported those names into a table in access named Employee. So the table, column and names look like:
Table: Employee
Column: Employee
Row1 Todd
Row2 Mike
Row3 Sarah
I need to take this table and turn it into a table (like a matrix in theory) that has each distinct combination of names and without having two of the same (ie Todd cant be in column1 and column2). For example:
Column1 Column2
Todd Mike
Todd Sarah
Sarah Mike
The code i had started is as followed:
Dim empArray(rst.RecordCount, rst.RecordCount) As String
'SET RECORDSET 1
strSql = "Select Employee from Employee"
Set rst = dbs.OpenRecordset(strSql)
'SET RECORDSET 2
strSql2 = "Select Employee from Employee"
Set rst2 = dbs.OpenRecordset(strSql2)
rst.MoveFirst
rst2.MoveFirst
Do Until rst2.EOF
Do Until rst.EOF
empArray = (rst2.GetRows(1, y) , (rst1.GetRows(1, x))
rst.MoveNext
Set x = x + 1
Loop
rst.MoveFirst
rst2.MoveNext
Set y = y + 1
Loop
Any help would be greatly appreciated. I have been tasked with getting this done ASAP and am not very experienced working in this realm. Thank you so much.
Last edited by a moderator: