Is there a way to use radio boxes to change the value of a text or string to be used in a msgbox? I am using the following but I get a compile error saying an object is needed:
dim weapon as string
~~~~~~~~~~~~~~~~~~~~
Private Sub optrope_Click()
Set weapon = "gun"
what is wrong? it should work.
One time, in programming class, I stuck an external CD burner up my USP port....
Comments
Set is used to create an update query and changes values in fields in a specified table based on specified criteria. I dont think this is what you are tying to achieve here.
Also depending on where your dim statement is, if the variable is needed by more than one sub you will need to change it to:
Public weapon as string
Always try to get into the habit or using a naming conventions to name your variables depending on the type you define them as. For example:
dim strWeapon as string
dim intCounter as integer
It makes it so much easier to read the code.
Hope this helps
G
: Is there a way to use radio boxes to change the value of a text or string to be used in a msgbox? I am using the following but I get a compile error saying an object is needed:
:
: dim weapon as string
: ~~~~~~~~~~~~~~~~~~~~
: Private Sub optrope_Click()
: Set weapon = "gun"
:
: what is wrong? it should work.
: One time, in programming class, I stuck an external CD burner up my USP port....
:
MsgBox text1.Text & "kills self with" & strweapon & "and" & strtypedeath & "and dies" & streffect, vbOKOnly, "Suicide-'O'-Matic"
and ideas?
Mays
Mays
:-( - "Mommy...I got caught with my server down!"
Run the programme again and when this line is highlighted in yellow move your mouse over the variables. What you should see is a value for each variable appearing. If any don't show up anything, they have not been assigned.
Hope this helps..
G
: It seems to work but when I hit the button to open the message box it gives me run time error '424' Object needed. I click debug and it highlights the following code:
:
:
: MsgBox text1.Text & "kills self with" & strweapon & "and" & strtypedeath & "and dies" & streffect, vbOKOnly, "Suicide-'O'-Matic"
:
: and ideas?
: