Open form - menu

  • Thread starter pm4698 via AccessMonster.com
  • Start date
P

pm4698 via AccessMonster.com

Hello there,

I need to push a button and have a msgBox from which i will have 4 options
(each option with a label and a checkbox).
Each option corresponds to a different form.
When i will choose an option (checkbox) then the selected form's name will be
saved at a string variable. Then i will use this string to open the selected
form with code:
docmd.openform "string_variable"

A piece of code that i tried to write is:

'public strInput As String 'Is used to save the form's name
Private button_name_Click()


Dim strInput1 As CheckBox 'Choose frm1
Dim strInput2 As CheckBox 'Choose frm2
Dim strInput3 As CheckBox 'Choose frm3
Dim strInput4 As CheckBox 'Choose frm4

Dim strMsg As String

Beep
strMsg = "Please choose which form to open..."
MsgBox "Form1" & vbCrLf & vbLf & strInput1 & _
"Form2" & vbCrLf & vbLf & strInput2 & _
"Form3" & vbCrLf & vbLf & strInput3 & _
"Form4" & vbCrLf & vbLf & strInput4 & _
"", _
vbInformation, "Choose form..."

strInput = InputBox(Prompt:=strMsg, title:="Choose form")

if me.strInput1.value= true then
strInput = "frm1 & "'"
else if me.strInput2.value= true then
strInput = "frm2 & "'"
else if me.strInput3.value= true then
strInput = "frm3 & "'"
else if me.strInput4.value= true then
strInput = "frm4 & "'"
end if
end if
end if
end if

end sub

So, when i choose a form from the msgbox, the name of the form that i chose,
is saved to strInput.

Then to open the form, i choise i will write:
DoCmd.OpenForm "strInput", , , , , ,

Can i do this?
If yes, could you give me some corrections to the code?

Thanks in advance
 
D

Daniel Pineault

Sadly, message boxes cannot be customized very much, not in the sense of
deisgn.

For what your are trying to do, you would be best to simply create a new
form which you would simply pop-up as a custom message box. This way you can
control evry aspect.
--
Hope this helps,

Daniel Pineault
http://www.cardaconsultants.com/
For Access Tips and Examples: http://www.devhut.net
Please rate this post using the vote buttons if it was helpful.
 

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