PSSMargaret
Registered User.
- Local time
- Yesterday, 17:37
- Joined
- Jul 23, 2016
- Messages
- 74
I am having an issue with a MainForm and SubForm scenario that includes filtering, running a query on the subform data and also opening a separate form to edit the subform records.
Scenario #1
I have a Navigation form that includes a list of clients. When a client is clicked in the list (this format is required by the end user), a form opens filtering the form to details regarding the client that was clicked. The form includes a subform of records pertinent to that client.
The MainForm includes a command button to run a query to limit the records in the subform which works fine and still maintains the filter because it affects only the subform. I have included another command button to open a form to edit a subform record but have not been able to get that code to work as of yet.
I would like to click a record in the subform that needs to be edited, click a command button to open that record in the Edit Record form. I have the below code but am receiving an error “Compile error: Method or data member not found”.
Or
Scenario #2
Since I haven’t been able to get the above to work, I created another form and in lieu of using a subform, I included the client records in the detail of the MainForm with the Client in the Form Header. It’s still accessed by clicking a client from the Navigation Form which opens the MainForm filtered to that client. With this layout, I have two different issues.
I created a command button and used the wizard to set it up which opens the current record in a form to edit it and that works great, however, when I converted it to VBA it did not convert correctly and I receive this error “Compile error: Syntax error” on the below code.
Also, the form didn't maintain the filter that was applied when I originally accessed the form so I altered the query to include the below parameter in the Client field of the query but it didn’t work either.
I appreciate any help getting either these scenarios working. Thanks so much.
Scenario #1
I have a Navigation form that includes a list of clients. When a client is clicked in the list (this format is required by the end user), a form opens filtering the form to details regarding the client that was clicked. The form includes a subform of records pertinent to that client.
The MainForm includes a command button to run a query to limit the records in the subform which works fine and still maintains the filter because it affects only the subform. I have included another command button to open a form to edit a subform record but have not been able to get that code to work as of yet.
I would like to click a record in the subform that needs to be edited, click a command button to open that record in the Edit Record form. I have the below code but am receiving an error “Compile error: Method or data member not found”.
Code:
DoCmd.OpenForm "frmClientDetails", , , "[ID]='" & Me.ID & "'"
Or
Scenario #2
Since I haven’t been able to get the above to work, I created another form and in lieu of using a subform, I included the client records in the detail of the MainForm with the Client in the Form Header. It’s still accessed by clicking a client from the Navigation Form which opens the MainForm filtered to that client. With this layout, I have two different issues.
I created a command button and used the wizard to set it up which opens the current record in a form to edit it and that works great, however, when I converted it to VBA it did not convert correctly and I receive this error “Compile error: Syntax error” on the below code.
Code:
Docmd.OpenForm "frmEdit", acNormal, "", "[ID]=" [&ID], , acNormal
Also, the form didn't maintain the filter that was applied when I originally accessed the form so I altered the query to include the below parameter in the Client field of the query but it didn’t work either.
Code:
[Forms]![frmClientDetails]![Client]
I appreciate any help getting either these scenarios working. Thanks so much.