• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 184
  • Last Modified:

help

hi all,

how to provide  hot keys to controls using default in option group and default command button

and  donot  do calculation  unless  the user  has entered  customer name .and donot  produce receipt unless user has done calculation
0
nanu
Asked:
nanu
1 Solution
 
Valliappan ANSenior Tech ConsultantCommented:
For command buttons and option buttons, you could set the caption property with a & sign before the letter with which you need to give the shortcut key for the button.

E.g.

cmdOK button, caption could be "&OK". So that, its shortcut key will be Alt+O for the user.

Similar for the option buttons. Say, if the caption is
"Customer" you could set it like: "C&ustomer", for setting Alt+u as shortcut key.

Put the customer name validation code in the customer name text box validate event. Similarly for other events like:

Private Sub txtCustName_Validate(Cancel As Boolean)
   If Len(txtCustName) = 0 Then
      Msgbox "Invalid Customer Name."
      Cancel = True
   End If
End Sub

Have a form level variable, for calculation, and if the user does the calculation set it to True or else it remain False.

You could check this variable in the cmdOK_Click event, before doing the further processing.

Private Sub cmdOk_Click()
   If mCalculate = False
      Msgbox "Calculation Not Done."
      Exit Sub
   End If
   :
   'your processing code goes here
End Sub

Set your Cancel button(if at all you have)'s CausesValidation property to False, so that the user could be able to cancel the operation without saving and quit out.

Hope this helps,
Cheers.
0
 
Valliappan ANSenior Tech ConsultantCommented:
And, in option groups, to set something to default, set one of the option button's value to true, in design time, or in Form_Load event.

0
 
DanRollinsCommented:
Hi nanu,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will suggest to:

    Accept valli_an's comment(s) as an answer.

nanu, if you think your question was not answered at all or if you need help, you can simply post a new comment here.  Community Support moderators will follow up.

EXPERTS: If you disagree with that recommendation, please post an explanatory comment.
==========
DanRollins -- EE database cleanup volunteer
0
 
Computer101Commented:
Comment from expert accepted as answer

Computer101
E-E Moderator
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now