Solved

help

Posted on 2001-06-12
5
171 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

Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
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…

810 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