I am creating a continuous form with only 3 fields that will end up having about 30 rows. I want to then be able to take the data on the form and add it to a table. Can someone give me the code to do this since you realy only have 3 field names
I select several items from a list box and then I take those items and create the recordsource for the form. on my continuous form I will have a textbox to add some data for each record, then I need to dump the info for each record into a table. I have found info on RecordsetClone which looks like what I want but I am now getting a type mismatch on the line "Set rst = Forms!form2.RecordsetClone" Any ideas
I don't see DAO avaliable in my list. I am using Access 2003. here is the code I am using
Dim rst As ADODB.Recordset
Set rst = Forms!form2.RecordsetClone
Dim str As String
Do While Not rst.EOF
str = rst.Fields("{ID}").Value
str = str & " " & rst.Fields("{Ename}").Value
str = str & " " & rst.Fields("{Text2}").Value
str = str & vbCrLf
rst.MoveNext
Loop
Debug.Print str
menu Tools -> References ...
select the Microsoft DAO 3.6 library.
And now your code:
Dim rst As [highlight]DAO[/highlight].Recordset
Set rst = Forms!form2.RecordsetClone
Dim str As String
Do While Not rst.EOF
str = rst("ID")
str = str & " " & rst("Ename")
str = str & " " & rst("Text2")
str = str & vbCrLf
rst.MoveNext
Loop
Set rst = Nothing
Debug.Print str
Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.