form/subform difficulty - won't give focus to the selected subform row.

M

Merlin

Thanks in advance, I have been struggling with this silly problem for
8 hours.

I have a form with a subform. Each form is based on a table. The two
forms are linked with a standard foreign key link that links all the
subform records to the parent form's primary key.

The subform uses a continuous form format.

I defined an ON CLICK event handler FUNCTION that is used by all the
fields in the subform. Here is the function:

*********************************************
Public Function SelectRow()

Forms![frmProjDetails]!WaterUsage.ControlSource = ""
Forms![frmProjDetails]!Text394.Value = Text21.Value

Forms![frmProjDetails]!WaterUsage.Value = WaterUsage1.Value
Forms![frmProjDetails]!Combo369.Value = Text17.Value

Forms![frmProjDetails]!Text402.Value = NumUnits.Value

End Function
*********************************************

All this does is take values from subform fields and copy the values
to fields in the parent form EXCEPT the first line, which changes the
data control source for one field. If I use the first line, I get
strange behavior (see below).

I have the same basic thing working in a separate, similarly complex
working form without problem. I also built a very simple test
form/subform, without problem.

Here is what happens if I include the first line:
When I click on the various rows in the subform, the data should be
copied to the parent form fields from each row I click on. INSTEAD,
no matter which row I click on, the subform switches focus to the
first field in the first row of the subform, and transfers data from
that row to the parent form.

If I remove the first line, the selected row gets the focus, and the
correct data is transferred to the parent form.

Any idea why this would be happening?

I've tried changing how I reference the fields, I've tried changing
field names, etc.

Thanks in advance!

jm

The only
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top