Go Back   Access World Forums > Microsoft Access Discussion > General

 
Reply
 
Thread Tools Rate Thread Display Modes
Old 01-13-2020, 02:25 PM   #1
lbs
Newly Registered User
 
Join Date: Dec 2019
Posts: 67
Thanks: 18
Thanked 10 Times in 10 Posts
lbs is on a distinguished road
Strange convert macros to vba

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.

lbs is offline   Reply With Quote
Old 01-13-2020, 02:35 PM   #2
theDBguy
Iím here to help
 
theDBguy's Avatar
 
Join Date: Oct 2018
Location: SunnySandyEggo
Posts: 7,280
Thanks: 63
Thanked 1,683 Times in 1,638 Posts
theDBguy has a spectacular aura about theDBguy has a spectacular aura about
Re: Strange convert macros to vba

Hi. Just curious, what is your Regional Settings?
__________________
Just my 2 cents...

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
theDBguy is offline   Reply With Quote
Old 01-13-2020, 02:37 PM   #3
Uncle Gizmo
Nifty Access Guy
 
Uncle Gizmo's Avatar
 
Join Date: Jul 2003
Location: Newbury Berks UK
Posts: 10,540
Thanks: 597
Thanked 1,008 Times in 950 Posts
Uncle Gizmo is a jewel in the rough Uncle Gizmo is a jewel in the rough Uncle Gizmo is a jewel in the rough
Send a message via Skype™ to Uncle Gizmo
Re: Strange convert macros to vba

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.

__________________
Code:
                 |||||
               @(~‘^‘~)@
-------------oOo---U---oOo-------------
|                                     |
|      Uncle Gizmo              |
|  
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
| | Ooo | |_________________ooO____( )________| ( ) ) / \ ( (_/ \_)
Uncle Gizmo is offline   Reply With Quote
Old 01-13-2020, 03:04 PM   #4
Uncle Gizmo
Nifty Access Guy
 
Uncle Gizmo's Avatar
 
Join Date: Jul 2003
Location: Newbury Berks UK
Posts: 10,540
Thanks: 597
Thanked 1,008 Times in 950 Posts
Uncle Gizmo is a jewel in the rough Uncle Gizmo is a jewel in the rough Uncle Gizmo is a jewel in the rough
Send a message via Skype™ to Uncle Gizmo
Re: Strange convert macros to vba

And these:-

Access 2007 Login Form - Nifty Access

MS Access 2007 Login & TempVars

MS Access 2007 Login & TempVars

Tidy up the Login Form
__________________
Code:
                 |||||
               @(~‘^‘~)@
-------------oOo---U---oOo-------------
|                                     |
|      Uncle Gizmo              |
|  
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
| | Ooo | |_________________ooO____( )________| ( ) ) / \ ( (_/ \_)
Uncle Gizmo is offline   Reply With Quote
Old 01-13-2020, 11:31 PM   #5
lbs
Newly Registered User
 
Join Date: Dec 2019
Posts: 67
Thanks: 18
Thanked 10 Times in 10 Posts
lbs is on a distinguished road
Re: Strange convert macros to vba

Quote:
Originally Posted by theDBguy View Post
Hi. Just curious, what is your Regional Settings?
My settings are UK
lbs is offline   Reply With Quote
Old 01-14-2020, 01:20 AM   #6
isladogs
High Noon Moderator
 
isladogs's Avatar
 
Join Date: Jan 2017
Location: Somerset, UK
Posts: 11,962
Thanks: 120
Thanked 3,331 Times in 3,005 Posts
isladogs is a splendid one to behold isladogs is a splendid one to behold isladogs is a splendid one to behold isladogs is a splendid one to behold isladogs is a splendid one to behold isladogs is a splendid one to behold isladogs is a splendid one to behold
Re: Strange convert macros to vba

When you do the conversion, is there a form running with a timer event?
If so, try disabling it.
__________________
If this answer has helped, please click the Thanks button and/or click the 'reputation scales' symbol on the left.

Colin (Mendip Data Systems)
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


Website links:
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


Spam, spam, spam, spam, spam, spam, spam (Terry Jones - RIP)
isladogs is offline   Reply With Quote
Old 01-14-2020, 01:26 AM   #7
lbs
Newly Registered User
 
Join Date: Dec 2019
Posts: 67
Thanks: 18
Thanked 10 Times in 10 Posts
lbs is on a distinguished road
Re: Strange convert macros to vba

Quote:
Originally Posted by isladogs View Post
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?

lbs is offline   Reply With Quote
Old 01-14-2020, 01:29 AM   #8
isladogs
High Noon Moderator
 
isladogs's Avatar
 
Join Date: Jan 2017
Location: Somerset, UK
Posts: 11,962
Thanks: 120
Thanked 3,331 Times in 3,005 Posts
isladogs is a splendid one to behold isladogs is a splendid one to behold isladogs is a splendid one to behold isladogs is a splendid one to behold isladogs is a splendid one to behold isladogs is a splendid one to behold isladogs is a splendid one to behold
Re: Strange convert macros to vba

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
__________________
If this answer has helped, please click the Thanks button and/or click the 'reputation scales' symbol on the left.

Colin (Mendip Data Systems)
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


Website links:
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


Spam, spam, spam, spam, spam, spam, spam (Terry Jones - RIP)
isladogs is offline   Reply With Quote
Old 01-14-2020, 02:46 AM   #9
CJ_London
Super Moderator
 
Join Date: Feb 2013
Location: UK
Posts: 11,400
Thanks: 40
Thanked 3,689 Times in 3,553 Posts
CJ_London is a glorious beacon of light CJ_London is a glorious beacon of light CJ_London is a glorious beacon of light CJ_London is a glorious beacon of light CJ_London is a glorious beacon of light
Re: Strange convert macros to vba

Quote:
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
__________________
CJ_London
_______________________
A little thanks goes a long way. If you have found this post useful, please tick the thanks button
CJ_London is offline   Reply With Quote
Old 01-14-2020, 03:09 AM   #10
Gasman
Enthusiastic Amateur
 
Gasman's Avatar
 
Join Date: Sep 2011
Location: Swansea, South Wales,UK
Posts: 4,801
Thanks: 455
Thanked 908 Times in 872 Posts
Gasman is a jewel in the rough Gasman is a jewel in the rough Gasman is a jewel in the rough
Re: Strange convert macros to vba

Quote:
Originally Posted by CJ_London View Post
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
__________________
Access novice. Sometimes trying to give something back.
Access 2007

Please, please use code tag # when posting code snippets

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Gasman is offline   Reply With Quote
Old 01-14-2020, 03:39 AM   #11
lbs
Newly Registered User
 
Join Date: Dec 2019
Posts: 67
Thanks: 18
Thanked 10 Times in 10 Posts
lbs is on a distinguished road
Re: Strange convert macros to vba

Quote:
Originally Posted by CJ_London View Post
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.
lbs is offline   Reply With Quote
Old 01-14-2020, 04:23 AM   #12
CJ_London
Super Moderator
 
Join Date: Feb 2013
Location: UK
Posts: 11,400
Thanks: 40
Thanked 3,689 Times in 3,553 Posts
CJ_London is a glorious beacon of light CJ_London is a glorious beacon of light CJ_London is a glorious beacon of light CJ_London is a glorious beacon of light CJ_London is a glorious beacon of light
Re: Strange convert macros to vba

only suggestion I can make is don't use the wizard and modify settings as I outlined
__________________
CJ_London
_______________________
A little thanks goes a long way. If you have found this post useful, please tick the thanks button
CJ_London is offline   Reply With Quote
Old 01-14-2020, 07:55 AM   #13
theDBguy
Iím here to help
 
theDBguy's Avatar
 
Join Date: Oct 2018
Location: SunnySandyEggo
Posts: 7,280
Thanks: 63
Thanked 1,683 Times in 1,638 Posts
theDBguy has a spectacular aura about theDBguy has a spectacular aura about
Re: Strange convert macros to vba

Quote:
Originally Posted by lbs View Post
My settings are UK
Hi. Just in case it helps, check out this article on International Dates.

__________________
Just my 2 cents...

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
theDBguy is offline   Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Convert form's Macros to Visual Basic InFlight Macros 14 12-17-2019 08:33 AM
Convert Macros to VBA sross81 Macros 5 10-05-2012 05:20 AM
Macros do not convert to VBA dthoms General 3 06-21-2011 01:22 PM
Embedded Macros don't convert to 2003 sal Forms 2 08-14-2010 12:37 AM
Convert 2007 native buttons/control macros for 2003 compatibility fau5tu5 Macros 5 06-19-2009 05:43 AM




All times are GMT -8. The time now is 04:59 AM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Featured Forum post


Sponsored Links


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World