Active3 months ago
- Access 2016 training video on the Where Condition in use with a macro. Learn how to click on a form button to open up another form, where, the current record in the current form will open up its.
- Mar 25, 2007 Open form using where clause. Microsoft Access / VBA Forums on Bytes. How do I use the where clause of the open form command to show an account with a matching ID to be displayed when the form is opened? I select a record on a continuous form and click and edit button. Sitemap Microsoft Access / VBA Answers Sitemap.
I am using Microsoft access and i want to open a form to a specific id when a button is clicked. Can i specify the id in the Do.open form command. the code below opens a form but then a dialog box opens asking to enter the id . anyone any ideas ?
Adding Conditions to a Macro. When you want a macro to run only under specific circumstances, you can add a condition to one or more of the macro actions. The macro condition states this effectively: If this condition is true, run this action. If it is not true, go to the next action, if any. This is a highly useful tool when programming an.
Fionnuala85.9k77 gold badges9696 silver badges133133 bronze badges
derekderek50077 gold badges1919 silver badges3030 bronze badges
3 Answers
First, change:
To:
Where Me.ID is the name of a field or control on the current form ( Microsoft Access - get record id when button is clicked ).
When you refer to a variable, put it outside the quotes:
This is going to be fine for an ID, which is numeric, but it will get a little more complicated with text and dates, because you will need delimiters. This will work well as long as
sometextvar
does not contain a quote:Otherwise
And dates take #
To avoid problems with locales, it is nearly always best to format to year, month, day, so:
Community♦
FionnualaFionnuala85.9k77 gold badges9696 silver badges133133 bronze badges
I tried I had the same, be sure that the name you give to the id is the name used in the form, not in the DB! IE, my id is
bgmCoderid
in DB, but pc_id
in my form!4,69677 gold badges3636 silver badges8989 bronze badges
Access Openform Macro
LaurentLaurent
ross2,29222 gold badges99 silver badges1919 bronze badges
user11728143user11728143