command button and add new record

M

mikesmith20055002

I am using Access 2000 and I created a form with one option group,
after the user makes their choice from the option group then they click
the "command button"
Problem:
I created a 'command button" and everytime the user clicks the button I
want the result of the choice they made to save and then a new record
(a blank form for the next user) be added with none of the options in
the option group choosen.
But what is currently happening is that the choice doesn't save and no
new record is being added.
How do I fix this?
 
M

mikesmith20055002

I wanted to add that the Properties of my form are set to "allow data
entry"
 
J

John Vinson

I am using Access 2000 and I created a form with one option group,
after the user makes their choice from the option group then they click
the "command button"
Problem:
I created a 'command button" and everytime the user clicks the button I
want the result of the choice they made to save and then a new record
(a blank form for the next user) be added with none of the options in
the option group choosen.
But what is currently happening is that the choice doesn't save and no
new record is being added.
How do I fix this?

Why use a button AT ALL?

If the option group is bound to the field in the table, and it's the
last (or only) control in the form's Tab Order, then selecting a value
will write the record to the table and move to the next (new, blank)
record with no action on your part.

If you do want a button instead, just set the Option Group's Control
Source to the name of the (integer) field that you want updated, and
put code in the Event Procedure of the button's Click event:

Private Sub cmdSave_Click()
DoCmd.GoToRecord acForm, Me.Name, acNewRecord
End Sub

John W. Vinson[MVP]
 

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

Top