Add New Record

  • Thread starter Thread starter Duane
  • Start date Start date
D

Duane

Newbie question!

Instead of using the standard navigational buttons offered by access, I want
to use me own buttons. I want to be able to add records using the OnClick
event.

I have a form called KeyControlMaster and a SubForm called Keys. I want to
put and button called Add New Key on the KeyControlMaster form that will add
a new record in the subform keys.

When I put the button on the KeyControlMaster form, it obviously adds a new
record KeyControlMaster table. I tried to create a macro that would add a
new record the the keys table, however, I get an error stating the object
Keys isn't open.

Normally, I would just put the button on the subform and be done with it,
but the subform is a continuous form and there really isn't a good place to
put a button.

If what I want to do is possible, which I am sure it is, would someone
kindly point me in the right direction.

Thanks in advance
 
Maybe something like this:

DoCmd.GoToControl "SubformControlName"
DoCmd.GoToRecord , , acNewRec

Note that if you created and named a form for use as a subform, that will
probably be the name of the subform control. If you used the wizard, it may
be something like Child1. In any case, you can check by going to design
view for the main form, clicking the edge of the subform, and viewing the
properties.
 
Thanks Bruce.

I actually tried to do what you suggested, however, I used the name for the
control to the first field in the table not the form control name. Silly
me! Thanks for straightening me out.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top