code error - changing from private to public

Geordie2008

Registered User.
Local time
Today, 07:48
Joined
Mar 25, 2008
Messages
177
Hi all,

This code works fine in a private sub

Code:
Dim ctl As Control
If ctl.Name <> ActiveControl.Name Then

when I put it in a public sub it doesn't work...

How do I need to update the syntax of the code?

Thanks,
Mandy
 
All sorted,

I needed:

If ctl.Name <> Forms!frmStaffDetails_ComboBox.ActiveControl.Name Then
 
you could probably use

activeform.activecontrol instead of explicitly specifying the from

(it may be screen.activeform.activecontrol)
 
Thanks,

Do you have a good website / link etc that explains the diff between all the different events on a forms properties?

For example, I cant assign values using the "on_Open" event, and I cant assign my code to the "On_Current" event either....

I just wanted to read something so I could decide if there was anything else I could try?

Thanks,
Mandy
 
Thanks,

Do you have a good website / link etc that explains the diff between all the different events on a forms properties?

For example, I cant assign values using the "on_Open" event, and I cant assign my code to the "On_Current" event either....

I just wanted to read something so I could decide if there was anything else I could try?

Thanks,
Mandy

There is a full list of Events in Access Help under Events. I would also try googling for "MS Access Events" and see what comes up
 
what are you trying to do?

in terms of what you are saying

the form open event occurs when the form opens - offhand, i thought controls were avaialble at that ponit.

the current event fires when you navigate to a new record, so all the controls are definitely avaialbe at that point.

---------
so what are you trying to accomplish with the code snippet you mentioned?
 
Hi,

I found that I needed to set.focus to the control, and then run the code I was trying to run.

I thought it was a problem with the event I was using, but after readin the help files, I realised it was my code.

Mandy
 

Users who are viewing this thread

Back
Top Bottom