Solved

help

Posted on 2001-06-12
5
169 Views
Last Modified: 2010-05-03
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
Comment
Question by:nanu
5 Comments
 
LVL 9

Accepted Solution

by:
Valliappan AN earned 50 total points
ID: 6181053
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
 
LVL 9

Expert Comment

by:Valliappan AN
ID: 6181058
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
 
LVL 5

Expert Comment

by:AndrewDev
ID: 6181139
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 7135948
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
 
LVL 1

Expert Comment

by:Computer101
ID: 7173217
Comment from expert accepted as answer

Computer101
E-E Moderator
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now