PC Review


Reply
Thread Tools Rate Thread

Adding a button to a VB form

 
 
DJ
Guest
Posts: n/a
 
      11th Jun 2009
Very VB novice - have basic form which is being used to fill a database. Need
to add 4 buttons which will be used to determine what type of data is coming
in i.e. question, comment, idea etc.

All work - can see buttons on form but when I select one of them when I run
get TRUE or FALSE in relevant column.

What do I need to do to get text as outlined above?
--
DJ
 
Reply With Quote
 
 
 
 
JLGWhiz
Guest
Posts: n/a
 
      11th Jun 2009
Part 1:
Button usually refers to command button, but in your case it looks like
either an option button (circle with dot) or a checkbox, since both ot these
types have values of True or False.

Part 2:
Assuming that the "buttons" are option buttons, then you can add code to
them by entering design mode and right clicking the button and then select
"View Code" from the pop up menu. Add code similar to this:

Private Sub OptionButton1_Click()
If Me.OptionButton1.Value = True Then
ActiveSheet.Range("A1") = "Question"
End If
Me.OptionButton1.Value = False
End Sub

You would need to change A1 to the appropriate cell reference, for each
OptionButton and assign the appropriate type of incoming data.

If you are using a command button, then you would not need the If statement.

Private Sub CommandButton1_Click()
ActiveSheet.Range("A1") = "Question"
End If




"DJ" <(E-Mail Removed)> wrote in message
news:FD4EF035-B05C-40DA-8A18-(E-Mail Removed)...
> Very VB novice - have basic form which is being used to fill a database.
> Need
> to add 4 buttons which will be used to determine what type of data is
> coming
> in i.e. question, comment, idea etc.
>
> All work - can see buttons on form but when I select one of them when I
> run
> get TRUE or FALSE in relevant column.
>
> What do I need to do to get text as outlined above?
> --
> DJ



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding a Search Button to a Form jonfromdon Microsoft Access Getting Started 4 18th Mar 2008 04:28 PM
Adding a button to the Appointment Form cookiesncreamychoc@hotmail.com Microsoft Outlook Program Addins 6 21st Mar 2006 02:09 PM
Adding button to form programatically =?Utf-8?B?U2ltb24gR3JlZW4=?= Microsoft Dot NET 1 3rd Dec 2004 01:15 PM
Adding a button to a form - by coding it Michael Microsoft Access Getting Started 3 17th Aug 2004 06:28 AM
Problem adding a command button to a form in order to open another form =?Utf-8?B?SmFuaWNl?= Microsoft Access Getting Started 2 10th May 2004 11:31 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:26 AM.