Solved Convert Form's Macros to VB not working

anski

Registered User.
Local time
Today, 12:22
Joined
Sep 5, 2009
Messages
93
My form has SEVERAL macros and I used the 'Convert Form's Macros to VB.' Sadly, the actions stopped working.

So I created a simple form to try to figure out the error. I created a macro on a field's On Mouse Down event: Message Box. Macro worked fine. Then I used the Convert Form's Macros to VB. The action does not work. I checked the Event Procedure, there are no duplicate names.

This is what the Convert Form's Macros to VB created:
'------------------------------------------------------------
' ddate_MouseDown
'
'------------------------------------------------------------
Private Sub ddate_MouseDown(Button As Integer, Shift As Integer, X As Double, Y As Double)

Beep
MsgBox "hello", vbOKOnly, ""

End Sub


I have attached the error message.

I also tried to Compile and I get the same error.
1670169182648.png

1670169527120.png
 
Sounds like corruption somewhere. Try the usual = C&R, decompile, copy all objects to new FE.
 
The macro with the same name is deleted?
 
This is not an answer to your particular problem, but something which I'm sure you would like to be aware of.

The conversion of macros to VBA does not always work correctly. See my blog here for more information.


If your macro refers to the contents of an object, for example, a textbox, then the conversion will assume that you meant the actual text box control (an object) "Not" it's contents (its value).

The mistake the conversion makes is omitting the value, which is usual practice for developers, as value is the "Default" and not required. (Except in this unusual case)
 
Sounds like corruption somewhere. Try the usual = C&R, decompile, copy all objects to new FE.
I did but still did not work. I could not get past the decompile process as it was pointing to the same issue. The form involved is also going to be used as subforms (but with a different table source) in other forms. Updating the name of the header forms in all the macros was cumbersome so I decided to use the Convert Form's Macro to VBA, and I could just use the Replace function to change the header form names. Sadly, this Access feature seems to be problematic.
 
you Replace "Double" (without quote) with "Single" (without quote).
that is the correct declaration.
 
you Replace "Double" (without quote) with "Single" (without quote).
that is the correct declaration.
oh wow. that worked! i will try this with the real form and the several embedded macros. thanks a lot!
 

Users who are viewing this thread

Back
Top Bottom