Populate Fields with a Button.

I

Irish P

Ok I am trying to make a simple database for a game I've been playing, but I
want to be able data very quickly. So instead of using a pull down box to
populate the field through the New record Form, I want buttons.

So that I create new record type in the name and click the appropriate
buttons and that's it. I want the button click to populate the field for me
so that I can still do9 querys and reports of it as if it was filled from a
combo box or text box.

Anyone have any ideas I'm totally lost.
 
J

John W. Vinson

Ok I am trying to make a simple database for a game I've been playing, but I
want to be able data very quickly. So instead of using a pull down box to
populate the field through the New record Form, I want buttons.

So that I create new record type in the name and click the appropriate
buttons and that's it. I want the button click to populate the field for me
so that I can still do9 querys and reports of it as if it was filled from a
combo box or text box.

Anyone have any ideas I'm totally lost.

Since you don't say anything about the structure of your table, the nature of
the data, or what values you want to populate into what fields, it's more than
a bit difficult to give specific instructions...

What you could do is use either a SetValue action from a Macro or some simple
code in a VBA Event Procedure in the button's Click event. Since I'm more
comfortable with the latter, here's an example:

Private Sub cmdLarge_Click()
Me!Size = "Large"
End Sub

Put this as the Code in the click event of a button named cmdLarge and it will
put the text string "Large" into the textbox named Size.

If you have several choices you might want to use an Option Group control
instead. It has a numeric value but you can use its afterupdate event to get
the same effect; say you had an option group with three buttons, values 1, 2
and 3, captioned Small, Medium and Large:

Private Sub optSize_AfterUpdate()
Select Case Me!optSize
Case 1
Me!Size = "Small"
Case 2
Me!Size = "Medium"
Case 3
Me!Size = "Large"
End Select
End Sub
 

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