Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I write code to tell Access where to save a value? 1

Status
Not open for further replies.

seawave

Technical User
Oct 21, 2002
30
US
I have a form with unbound objects and I do not know how to write the code to tell Access to save the value to the field in my table. Example: my user types a value of F0002 in the unbound textbox on the form. The field "CableName" is in my Cable Table. I want to save the F0002 value to the CableName field in the Table and then when the user completes the form, save the record and clear the values on the form for the next record entry.

Any help would be appreciate.

Thank you.
 
Well if they are all unbound you can do this

Dim rst as DAO.Recordset
Dim frm as Form
Set frm = Forms!YourFormName
Set rst = CurrentDb.OpenRecordset("Cable Table",dbOpenDyanset)
rst.AddNew
rst!CableName = frm.textboxname
rst!NextField = frm.nextfield
rst!SomeOtherField = frm.someotherfield
rst.Update

frm.textboxname = Null
frm.nextfield = Null
frm.someotherfield = Null

set frm = Nothing
set rst = Nothing

Paul

 
Paul,
Thanks for the reply.
I entered my code, but I'm receiving an error message:
"Compile error User-defined type not defined".

Thanks.
Seawave
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top