Charlotte Foust
cfoust at infostatsystems.com
Mon Oct 1 10:46:04 CDT 2007
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
No trees were killed in the sending of this message. However a large number of electrons were terribly inconvenienced.
--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com