wiremonkey22
Registered User.
- Local time
- Today, 04:06
- Joined
- Jan 13, 2008
- Messages
- 68
I have two linked (text) tables in which i pull records into two other tables only to delete the spaces now i want to combine these two tables with a query the problem is they do not have anything in common ive tried to use an autonumber but these tables never have the same number of records
what i want is the first column in table1 and columns 1-5 in table two to align in the new table however when i run the query with both tables i only get the first record in table1 and all the records from table2 is it possible in VBA or a Query or any eaiser way to take record 1 from table1 and record 1 from table2 to and combine in new table for all the records.
Ive played with the following code but unsuccessful
Public Function UpdateProgrammer()
Dim db As Database
Dim Numbrec As DAO.Recordset 'table 1'
Dim Lenrec As DAO.Recordset 'table 2'
Dim Programer As Recordset 'new table'
Set Programer = db.OpenRecordset("tblNumber_LenMulti")
Set db = CurrentDb
Set Numbrec = db.OpenRecordset("tblNumbers", dbOpenDynaset)
Set Lenrec = db.OpenRecordset("tblLens", dbOpenDynaset)
Lenrec.MoveFirst
Do While Not Lenrec.EOF
With Programer
.AddNew
!Number = Numbrec!Numbers
!Group = Lenrec!Group
!Len1 = Lenrec!Len1
!Len2 = Lenrec!Len2
!Len3 = Lenrec!Len3
!Len4 = Lenrec!Len4
End With
Lenrec.MoveNext
Loop
End Function
Get object variable or with block not set error
Not much experience with the With function or loops sorry if this is newbie error
Thanks in advance
what i want is the first column in table1 and columns 1-5 in table two to align in the new table however when i run the query with both tables i only get the first record in table1 and all the records from table2 is it possible in VBA or a Query or any eaiser way to take record 1 from table1 and record 1 from table2 to and combine in new table for all the records.
Ive played with the following code but unsuccessful
Public Function UpdateProgrammer()
Dim db As Database
Dim Numbrec As DAO.Recordset 'table 1'
Dim Lenrec As DAO.Recordset 'table 2'
Dim Programer As Recordset 'new table'
Set Programer = db.OpenRecordset("tblNumber_LenMulti")
Set db = CurrentDb
Set Numbrec = db.OpenRecordset("tblNumbers", dbOpenDynaset)
Set Lenrec = db.OpenRecordset("tblLens", dbOpenDynaset)
Lenrec.MoveFirst
Do While Not Lenrec.EOF
With Programer
.AddNew
!Number = Numbrec!Numbers
!Group = Lenrec!Group
!Len1 = Lenrec!Len1
!Len2 = Lenrec!Len2
!Len3 = Lenrec!Len3
!Len4 = Lenrec!Len4
End With
Lenrec.MoveNext
Loop
End Function
Get object variable or with block not set error
Not much experience with the With function or loops sorry if this is newbie error
Thanks in advance
