Strange convert macros to vba (1 Viewer)

lbs

Registered User.
Local time
Today, 22:14
Joined
Dec 22, 2019
Messages
109
Is anyone experiencing the same issue as I am?
When I create a button to open a form with filter, access creates a macro for that. I don’t like macros and I then convert macro to vba by clicking appropriate button on ribbon. Then the button would not work because during the process access puts & in the wrong place inside [] in where condition of the code. I have to open code window and manually move & to the right place. This is happening all the time. Is it a bug in my ms office?

Also when I create a button to open a form filtered by date shown in a field I get wired results. For example the date is 03/02/2020 and the opening form shows records with the date 02/03/2020. I have to create a text date analog for date for the purpose of filtering.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 14:14
Joined
Oct 29, 2018
Messages
21,447
Hi. Just curious, what is your Regional Settings?
 

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 22:14
Joined
Jul 9, 2003
Messages
16,269
I have on occasion converted macros into VBA. In the past this always seemed to work OK, but I have noticed problems recently. I've made notes on my website here:-

TempVars Value Error Video 1 (2:31)

I think you might find the first video video number one the most helpful.
 

isladogs

MVP / VIP
Local time
Today, 22:14
Joined
Jan 14, 2017
Messages
18,209
When you do the conversion, is there a form running with a timer event?
If so, try disabling it.
 

lbs

Registered User.
Local time
Today, 22:14
Joined
Dec 22, 2019
Messages
109
When you do the conversion, is there a form running with a timer event?
If so, try disabling it.
Do you mean the form which I want to open by this button?
 

isladogs

MVP / VIP
Local time
Today, 22:14
Joined
Jan 14, 2017
Messages
18,209
Either that...or another form running in the background.
Timer events cause problems with the cursor jumping about when writing code in the VBE. I was wondering whether it could have a similar effect in your situation
 

CJ_London

Super Moderator
Staff member
Local time
Today, 22:14
Joined
Feb 19, 2013
Messages
16,600
When I create a button to open a form with filter, access creates a macro for that.
you can disable the macro option for events by going to File>Options>Object Designers - Form/Report Design View and tick the 'always use event procedures' option.

However not sure if this works if you are using the wizard which seems to always create a macro
 

Gasman

Enthusiastic Amateur
Local time
Today, 22:14
Joined
Sep 21, 2011
Messages
14,218
However not sure if this works if you are using the wizard which seems to always create a macro

I tested on my 2007 and an embedded macro is created. :(

Apparently if the DB is an mdb file, then event code will be produced.
Just tested that with one of my few mdb files and it indeed does produce vba code.

HTH
 

lbs

Registered User.
Local time
Today, 22:14
Joined
Dec 22, 2019
Messages
109
you can disable the macro option for events by going to File>Options>Object Designers - Form/Report Design View and tick the 'always use event procedures' option.

However not sure if this works if you are using the wizard which seems to always create a macro


Tried is and still Macro is created.
 

CJ_London

Super Moderator
Staff member
Local time
Today, 22:14
Joined
Feb 19, 2013
Messages
16,600
only suggestion I can make is don't use the wizard and modify settings as I outlined
 

Users who are viewing this thread

Top Bottom