Dialog Button Keypress 
Author Message
 Dialog Button Keypress

I'm feeling somewhat stupid this morning but I can't solve a minor problem.  I have a dialog box "dialog 1" with several edit boxes and a button (button 2) named "Add" and a button (button 3) named "Cancel".  When the user enters data and "Add" everything works just fine.  When "Cancel" is pressed the procedure continues and adds a blank record.

How do I capture the button press and simply "End"?  i.e.

If dialogbox.buttonpress=cancel
    end
end if

Sorry for the brain block this Saturday morning ...

Best Regards,

David
C.M. Consultants,Inc



Thu, 03 Mar 2005 00:22:36 GMT  
 Dialog Button Keypress
It is unclear how this could happen.  Do you have both buttons assigned to
the same macro.

You can get the button caption that called the routine with

sButtonName = Application.Caller

and have your code conditionally execute.

Regards,
Tom Ogilvy


Quote:
> I'm feeling somewhat stupid this morning but I can't solve a minor

problem.  I have a dialog box "dialog 1" with several edit boxes and a
button (button 2) named "Add" and a button (button 3) named "Cancel".  When
the user enters data and "Add" everything works just fine.  When "Cancel" is
pressed the procedure continues and adds a blank record.
Quote:

> How do I capture the button press and simply "End"?  i.e.

> If dialogbox.buttonpress=cancel
>     end
> end if

> Sorry for the brain block this Saturday morning ...

> Best Regards,

> David
> C.M. Consultants,Inc



Thu, 03 Mar 2005 00:59:39 GMT  
 Dialog Button Keypress
You want the Cancel button to end another procedure while it's running?

I'm feeling somewhat stupid this morning but I can't solve a minor problem.  I
have a dialog box "dialog 1" with several edit boxes and a button (button 2)
named "Add" and a button (button 3) named "Cancel".  When the user enters data
and "Add" everything works just fine.  When "Cancel" is pressed the procedure
continues and adds a blank record.

How do I capture the button press and simply "End"?  i.e.

If dialogbox.buttonpress=cancel
    end
end if

Sorry for the brain block this Saturday morning ...

Best Regards,

David
C.M. Consultants,Inc



Thu, 03 Mar 2005 01:17:41 GMT  
 Dialog Button Keypress

Quote:
>It is unclear how this could happen.  Do you have both buttons assigned to
>the same macro. (?)

Mea culpa.  Instead of having the dialog box call the routine I included the dialog box within the routine.  Everything works so I decided to put in error checking on the data and if it incomplete it ends with a "Data Not Valid" message.  Doesn't matter which button is used.

I shall know better the next time.

Quote:

>You can get the button caption that called the routine with

>sButtonName = Application.Caller

I appreciate this tip. Thanks.

Best,

David

Quote:

>and have your code conditionally execute.

>Regards,
>Tom Ogilvy



>> I'm feeling somewhat stupid this morning but I can't solve a minor
>problem.  I have a dialog box "dialog 1" with several edit boxes and a
>button (button 2) named "Add" and a button (button 3) named "Cancel".  When
>the user enters data and "Add" everything works just fine.  When "Cancel" is
>pressed the procedure continues and adds a blank record.

>> How do I capture the button press and simply "End"?  i.e.

>> If dialogbox.buttonpress=cancel
>>     end
>> end if

>> Sorry for the brain block this Saturday morning ...

>> Best Regards,

>> David
>> C.M. Consultants,Inc

Best Regards,

David
C.M. Consultants,Inc



Thu, 03 Mar 2005 02:14:51 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Ommand button KeyPress/Up/Down events

2. dialog box when Send/Receive button is pressed

3. No change password button in login dialog

4. Office 97 Bad Dialog Buttons

5. dialog box and buttons

6. Custom dialog box / option buttons

7. How preventing a close-button in dialog fields?

8. cancel button in dialog sheet

9. Dialog Box Cancel Button

10. Creating Dialog Boxes w/o Buttons in 95


 
Powered by phpBB® Forum Software © phpBB Group