Newbie - fill a field in new form? Plus a couple of more...

  • Thread starter Thread starter Ohaya
  • Start date Start date
O

Ohaya

Hi,

I have two forms in my database. One just has buttons on it (a kind of
"menu" form), to start up other forms, e.g., another form is used to add
a record, etc.

When I start the "add record" form, I want to have the "add record" form
have several of the fields pre-filled. I'm assuming I do that in the
Form_MainForm Command0 module, but how do I reference the fields
(they're all text fields) in the "add record" form from the menu form?

Also, once I'm in the "add record" form, I want to have buttons to save
the record and to cancel/exit without saving. How do I make the "save"
button save the record in the form and then exit?

Thanks,
Jim
 
My interpretation of what you want could be off, but it
sounds like you have a switchboard (form with lots of
buttons that opens other forms) and the add record form.
The fields of the add record form I am assuming have been
created with the use of a table (for simplicity sake, i'll
call it the Add_Record_Table). To prefill the fields, you
simply have to create a select query on the Add Record
form, select the Add_Record_Table and then the fields you
want on the form. Not sure if that is what you were
looking for, if not, sorry.

As for saving the record. It automatically saves when it
has been updated and closed. However, if you want to do
the save manually with a button.
1. Create the button
2. Under properties select an event (On Click usually)
3. You can choose macro, code, whatever, I prefer code.
4. The code builder brings you to VB
5. DoCmd.RunCommand acCmdSaveRecord is the code for saving
the record. That should do it.

Hope this helped
-RN
 
Back
Top