[AccessD] On Click Event in Command button versus Label;

Charlotte Foust cfoust at infostatsystems.com
Mon Apr 18 17:37:42 CDT 2005


LOL Haven't you followed any of the great event debates?? <vbg>

On form #1 declare this:

WithEvents frm As Form_Form2

Or this:

WithEvents frm As Form

That allows you to create a frm_Close event procedure for the other form
on Form1.

Then in the event of Form1 the opens Form2, instantiate the frm object:

DoCmd.OpenForm "Form2"
Set frm = forms!Form2


Charlotte Foust


-----Original Message-----
From: Rocky Smolin - Beach Access Software [mailto:bchacc at san.rr.com] 
Sent: Monday, April 18, 2005 1:30 PM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] On Click Event in Command button versus Label;


"open the other form using automation and sink its Close event on the 
calling form"

Como?

Rocky

----- Original Message ----- 
From: "Charlotte Foust" <cfoust at infostatsystems.com>
To: "Access Developers discussion and problem solving" 
<accessd at databaseadvisors.com>
Sent: Monday, April 18, 2005 1:07 PM
Subject: RE: [AccessD] On Click Event in Command button versus Label;


> So is that the routine behind a button or a label?  I have to say that

> I wouldn't do it the way you appear to be attempting with either.  You

> don't need a DoEvents loop if you open the other form using automation
> and sink its Close event on the calling form.   DoEvents is sometimes
> necessary, but I avoid it whenever possible, since it also can cause 
> hangups.  Simply put any code to be run after the other form closes in

> the event sink on the calling form.
>
> Charlotte Foust
>
>
> -----Original Message-----
> From: Rocky Smolin - Beach Access Software [mailto:bchacc at san.rr.com]
> Sent: Monday, April 18, 2005 9:10 AM
> To: Access Developers discussion and problem solving
> Subject: Re: [AccessD] On Click Event in Command button versus Label;
>
>
> Charlotte:
>
> It's just: Private Sub cmdContinue_Click()
>
> in that procedure there's a call to:
>
> ' get next question
>    strNext = GetNextQuestion
>
> and those lines of code appear in the GetNextQuestion function.
>
> Normally GetNextQuestion returns the next question in the assessment, 
> but there are several charts in the assessment - dieases, sleeping 
> pills, medications, relaxations techniques, activities in bed, etc. - 
> which contain
> a bunch of check boxes.
>
> When they are loaded, instead of closing the main assessment form, I 
> just make it invisible and use that SysCmd function to know when the 
> chart form
> closes.
>
> Do you think using the IsLoaded property of the AllForms collection 
> might make a difference?  Shouldn't but who knows.  After all, it's 
> Access.
>
> TIA
>
> Rocky
>
>
>
> ----- Original Message -----
> From: "Charlotte Foust" <cfoust at infostatsystems.com>
> To: "Access Developers discussion and problem solving"
> <accessd at databaseadvisors.com>
> Sent: Monday, April 18, 2005 8:42 AM
> Subject: RE: [AccessD] On Click Event in Command button versus Label;
>
>
>> I've never found that to be true, Rocky, and I have used labels as 
>> light weight "buttons" in several recent versions of Access.  What 
>> does the declaration for the procedure look like?
>>
>> Charlotte Foust
>>
>>
>> -----Original Message-----
>> From: Rocky Smolin - Beach Access Software [mailto:bchacc at san.rr.com]
>> Sent: Sunday, April 17, 2005 9:36 PM
>> To: AccessD at databaseadvisors.com
>> Subject: [AccessD] On Click Event in Command button versus Label;
>>
>>
>> Dear List:
>>
>> Is there a difference in how the On Click event works for a command 
>> button versus a label in Access 2003.
>>
>> I had a form that was working with command buttons.  But the gray 
>> command buttons are ugly.  So I substituted a label and put the code 
>> from the command button behind the label.
>>
>> When you click this button (or label) it opens another form, makes 
>> the
>
>> calling for invisible until the called form closes:
>>
>>            DoCmd.OpenForm "frmActivitiesInBed"
>>            Me.Visible = False
>>            Do While SysCmd(acSysCmdGetObjectState, acForm,
>> "frmActivitiesInBed") <> 0
>>               DoEvents
>>            Loop
>>
>> This works real well when in a command button On Click but when it's 
>> called in a label's On Click, the system totally hangs with 100% CPU 
>> usage.
>>
>> Another curious symptom: If I alt-Tab away from the app window while 
>> it's froze, and back again, it unfreezes the app.
>>
>> Does this sound familiar to anybody?
>>
>> MTIA,
>>
>> Rocky Smolin
>> Beach Access Software
>> http://www.e-z-mrp.com
>> 858-259-4334
>> --
>> 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
> -- 
> 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