View Single Post
Old 07-01-2014, 06:53 AM   #6
tatiarends
Newly Registered User
 
Join Date: Apr 2014
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
tatiarends is on a distinguished road
Re: Access button select form

First I created my main form, lets call it "Mainfrm". I created a text box for where I needed the result of the selection to appear, this textbox must also have as Control Source the table field where you need the results to be stored, let's call it "Coordinate".

I then created another form Matrixfrm (the popup menu) with command buttons each labeled accordingly A1, A2, A3 etc and also make sure the name of the button are those too, this is very important. I created a textbox on that form and labeled it Coordinate and also made the Control Source of that textbox the same as the field in my table, just like I did on Mainfrm. I also made the textbox not visible. Then, for each button of my matrix I put on the On Click event this code:

Private Sub A1_Click()
Me.Coordinate = "A1 - Very High"

On Error GoTo Err_A1_Click

DoCmd.Close


Exit_A1_Click:
Exit Sub

Err_A1_Click:
MsgBox Err.DESCRIPTION
Resume Exit_A1_Click
End Sub

That is for when button A1 is clicked. You must use the same code for each button but changing the labels This code also makes Matrixfrm to exit upon clicking any button, so if you do not want this automatic closing, delete the Exit_A1_Click and below from your code.

This should make your textbox on Mainfrm appear with the result of what you clicked on Matrixfrm.

Hope this helps!
tatiarends is offline   Reply With Quote