Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Message Buttons

Status
Not open for further replies.

mguwc

Technical User
Mar 16, 2004
74
US
I would like to add text buttons to my forms that when a specific one is clicked, the text associated with that button appears in a comment field.

Example: 5 buttons
Button 1 - Left message
Button 2 - Busy
Button 3 - No answer
Button 4 - appointment scheduled
Button 5 - sent resources

How do I go about this. I would guess I would do it through code, at click event, but I don't know the code.

Can anyone assist?
 
Hi alter this to suit on the on click event
MsgBox "Well Colin, here your report, would you like a cup of tea as well??. Your email has been sent (It does contain offensive material!!) and you may now quit !!!!!!!!!!!!!!!!", vbOKOnly,
 
By doing as you wrote, I get a message box. What I would like is for the text to appear in a field called "comments" Therefore, is there anyway to transfer this text into [narratives].[comments]?
 
Try
Private Sub Command14_Click()
me!YourTextFiedName = WhatYourCommandButtonStates
Exit_CmdCare_Click:
Exit Sub
End Sub

Hope this helps
Hymn
 
Sorry misread
Try this on each button comments = "Left message", etc. comments being the name of your text box on your form.
 
I would use an Option Group with command buttons for this application. Look up how to create an option group from the Tool Box. Then add the five toggle command buttons inside of the option group. Size them all the same and align them properly. The Option group is where the code will go. The Buttons can only be selected one at a time so no double buttons clicks can occur. Each button has a value starting at 1 thru 5. Just leave it as is.

Now name the Option Group as you wish. Open the AfterUpdate event procedure and put in the following code:

Code:
Select Case [i][red]OptionGroupName[/red][/i]
    Case 1
       Me![[i][red]textboxname[/red][/i] = "Left message"
    Case 2
       Me![[i][red]textboxname[/red][/i] = "Busy"    
    Case 3
        Me![[i][red]textboxname[/red][/i] = "No Answer"    
    Case 4
        Me![[i][red]textboxname[/red][/i] = "Appointment Scheduled"    
    Case 5
        Me![[i][red]textboxname[/red][/i] = "Sent Resources"    
End Select

You now can set the Default value for the Option Group to 1 thru 5 depending upon which would be the most used. This way a selection doesn't need to be made in many cases. You should also setup the Default for the textbox for the same selection to start new records.

Post back if you have any questions.

[COLOR=006633]Bob Scriver[/color]
MIState1.gif
[COLOR=white 006633]MSU Spartan[/color]
 
In addition to my posting above I would set the .caption property of each of the buttons to the action being recorded:

Left Msg., Busy, etc.

[COLOR=006633]Bob Scriver[/color]
MIState1.gif
[COLOR=white 006633]MSU Spartan[/color]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top