I have a form frmDisplayVars with a subform subfrmDisplayVars. The sub form initially has its RecordSource set to "" and is set dynamically from a maketable when needed.
In the OnLoad for the main form, the subform RecordSource is set to a table "Table.Test". This is so that the load routine can execute a maketable query to create the form "Test" in advance. This produces a table from a crosstab query. All this works OK so far.
However, I wish to be able to double click on the datasheet in the subform to then open another form with data related to the cell/contol that was clicked on. Essentially creating a room occupancy table for a range of dates and rooms. Rows are rooms and columns are dates.
I have a problem with setting the OnBblClick for the subform controls.
For example the 2 test code lines for the control "RoomName" illustrate.
The first line works fine and returns as it should the name of the control "RoomName".
It is the second line which I need to set the event code for OnDblClick which fails with error no. 2455 which suggests wrong syntax for referencing a control on a subform. Since the control reference appears OK as suggested by the first line I am stumped as to what is wrong.
I can't set the event procedures manually as they are not known in advance until the table "Test" is made so need to be able to set the control events dynamically.
Would be most grateful for a solution otherwise the project is at an impasse!
Thanks in advance.
John B
In the OnLoad for the main form, the subform RecordSource is set to a table "Table.Test". This is so that the load routine can execute a maketable query to create the form "Test" in advance. This produces a table from a crosstab query. All this works OK so far.
However, I wish to be able to double click on the datasheet in the subform to then open another form with data related to the cell/contol that was clicked on. Essentially creating a room occupancy table for a range of dates and rooms. Rows are rooms and columns are dates.
I have a problem with setting the OnBblClick for the subform controls.
For example the 2 test code lines for the control "RoomName" illustrate.
Code:
Forms!frmDisplayVars!subfrmDisplayVars.Form!RoomName.Name
Forms!frmDisplayVars!subfrmDisplayVars.Form!RoomName.OnDblClick = "=TestMe()"
The first line works fine and returns as it should the name of the control "RoomName".
It is the second line which I need to set the event code for OnDblClick which fails with error no. 2455 which suggests wrong syntax for referencing a control on a subform. Since the control reference appears OK as suggested by the first line I am stumped as to what is wrong.
I can't set the event procedures manually as they are not known in advance until the table "Test" is made so need to be able to set the control events dynamically.
Would be most grateful for a solution otherwise the project is at an impasse!
Thanks in advance.
John B