Reputation: 57
I have two forms. One connects to a table and is used to enter, change and view entries. From the second form I want to open the first form to a certain record.
Table contains records for 6 different items, but there are multiple records for each item. A new one is added when old record is marked as closed (true/false tick box.
I can create the code for opening a record based on just the number of item, but am unable to add the checkbox consideration.
DoCmd.OpenForm "Form1", , , "Form1.[Variable]=" & Me![Combo4]
This reads the number from a dropdown menu box on Form2 and opens Form1 with that value. Now I need to add another condition to the open command.
DoCmd.OpenForm "Form1", , , "Form1.[Variable]=" & Me![Combo4] And "Form1.[Variable2] <>" & Me![Checkbox]
This should open only the record for a certain numbered item and only the record that hasn't been closed yet (I included a hidden checkbox on Form2 to use same Me![] command, but it doesn't work.
Upvotes: 1
Views: 668
Reputation: 56026
There are some quotes to manage:
DoCmd.OpenForm "Form1", , , "Form1.[Variable] = " & Me![Combo4] & " And Form1.[Variable2] <> " & Me![Checkbox] & ""
Upvotes: 2