Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

help

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

856 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