[AccessD] Strange Command Button Behavior

Kaup, Chester Chester_Kaup at kindermorgan.com
Mon Oct 1 13:20:24 CDT 2007


I was using OnExit events on a start date and end date text boxes on the
form to perform data validation. Maybe there is a better way to do this?

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Charlotte
Foust
Sent: Monday, October 01, 2007 11:12 AM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] Strange Command Button Behavior

First examine why you have OnExit events there.  If this is in a header,
you can't have all that many controls in it.  Why not just use tab order
and skip the OnExit.  Setting a focus in OnExit can drive a user crazy.

Charlotte Foust 

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Kaup, Chester
Sent: Monday, October 01, 2007 9:08 AM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] Strange Command Button Behavior

Exactly. The OnExit event of the TextBox StartDate runs instead of the
print command. How to detect the command button click and bypass the on
OnExit Event???

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Gustav Brock
Sent: Monday, October 01, 2007 10:53 AM
To: accessd at databaseadvisors.com
Subject: Re: [AccessD] Strange Command Button Behavior

Hi Chester and Charlotte

 - or an OnExit at StartDate ...

/gustav

>>> cfoust at infostatsystems.com 01-10-2007 17:46 >>>
Chester,

It isn't the button click code that's the problem.  Have you put in
break points to be sure the click event is actually occurring the first
time you click it?  It sounds like you might have an OnEnter event
firing first.

Charlotte Foust 

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Kaup, Chester
Sent: Monday, October 01, 2007 7:28 AM
To: Access Developers discussion and problem solving
Subject: [AccessD] Strange Command Button Behavior

I have a command button in the header of form to print a report. When I
click on the button the focus moves from a text box on the form named
StartDate to a text box on the form named EndDate. The report does not
print. The second time I click the command button the form prints. Code
for the command button is below. I tried compacting and repairing the
database and moving everything to a new form but to no avail. 

Private Sub Command1_Click()
On Error GoTo Err_Command1_Click

    Dim stDocName As String

    stDocName = "rpt All Manifolds Oil Gas Water 90 Days"
    DoCmd.OpenReport stDocName, acNormal

Exit_Command1_Click:
    Exit Sub

Err_Command1_Click:
    MsgBox Err.Description
    Resume Exit_Command1_Click
    
End Sub


Chester Kaup
Engineering Technician
Kinder Morgan CO2 Company, LLP
Office (432) 688-3797
FAX (432) 688-3799




--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com


-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com

-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com





More information about the AccessD mailing list