Access 2013 Macro Tools SetProperty if DataEntry mode is Yes

geospatial

Active Member
Joined
Sep 2, 2008
Messages
290
I am trying to figure out how I do an if statement with Macro Tools that looks at what DataEntry value is set to and then change the visibility on a combobox depending on what is returned.

For instance I have cmboLookup on frmRaters.
on my switchboard I have 2 buttons. One to open frmRaters in DataEntry = Yes and one button to open frmRaters with DataEntry - No.

I want my cmboLookup to be visible when the form opens in Edit mode and not be visible when opened in Add mode.
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
The following assumes you understand what the DataEntry mode means, because many think it automatically means records can be entered. If you're not sure, see
https://support.office.com/en-us/article/DataEntry-Property-f4236759-27f6-4fcd-abb0-4aa4acd8fe87

The simplest is probably to make use of the DataEntry mode parameter of the OpenForm method of the Docmd object. The syntax is
DoCmd.OpenForm(FormName, View, FilterName, WhereCondition, DataMode, WindowMode, OpenArgs)

The usage on the yes button click event might be like DoCmd.OpenForm(FormName, , , , True)
and for the no, DoCmd.OpenForm(FormName, , , , False)
It's also possible to pass values, conditions, information, etc. using the OpenArgs property (last one listed), but for your case, it is possible to effect the way the form opens by using a built in parameter of the method that opens the form, so why not use it? As for macros, the DataEntry mode parameter might be available in the macro once you start invoking the steps to open a form.

Umm, I re-read, and I see that you want to effect the visibility of a control. Sorry.
In code, I'd check the property of the form itself. If DateEntry property is True and that's when you want the control to be visible, then I'd use Me.YourControlName.visible = True
Now that I see there's a slightly different need, you could also use the OpenArgs parameter. Again, not being a big macro user, I think you could embed a macro in the form's open event and do it that way.At this point, I don't know how easily you could handle a code solution, so I'll stop babbling here and just say I could write the event code for you if you could make use of it.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top