I need to be able to duplicate all fields in a form, including recordsets in a subform and three other subforms in a tab control, and place all the data in a new form with it's autonumber. Can anyone help me with the code?
open a recordset
Dim db as database, rst as recordset, SQL as string
Set db = CurrentDb
Set rst = db.OpenRecordset("YourNewTable"
then to get data from a main form its:
me![Textboxname]
from a subform its
me![subformname]![Textboxname]
'Add a new record
rst.addnew
rst!Name = me![Name] ' < just sample of how main form
rst!Invoice = me![subformname]![Invoice] ' < just sample of how subform
rst.update ' if you have a addnew you must have a update
'or
rst.edit 'is how to update a field
rst!name = me![Name]
'and then
rst.update 'is required when all done updating.
rst.close ' its always a good idea to close things up when all done this closes the recordset
db.close 'this closes the database
DougP, MCP
dposton@universal1.com
Ask me how Bar-codes can help you be more productive.
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.