One or the other but not both actions work on subform

A

Al

I am using Access 2000 to emulate an outdated piece of software that we want
to retire. I am having a problem with one of the form/subform interactions
I’m building. The mainform displays one record selected on the subform
datasheet, which has several records showing for the selected location or
license on the mainform. Along with the bound fields on the mainform there
are 4 unbound combo boxes that work fine at moving through the records as
they are selected.
The problem I’m having is that when a record is selected in the subform, the
information for that record is mirrored on the mainform (for editing
purposes). That works fine; however, I also want to be able to select one or
all of the records in the subform, copy them and paste them to a new license
as a sort of template. (This is how its handled in the obsolete software)
I am using the subform Click event to trigger the coordination between the
selected record on the subform to the displayed record on the mainform.
Because of this, I cannot select an entire record or multiple records on the
subform. When I click on the subform record, the first field in the subform
record is highlighted but not the enitre row, which is what I want it to do,
or to highlight all of the record rows, as I drag my mouse, needed for the
copy and paste.
If I disable the code in the subform Click event, I’m able to select one or
all of the records I want, but the synchronization between the forms quits
working. I have the Parent/Child relationship setup between two key fields
used to pull up all of the records in the subform that are relational to the
unbound combo boxes on the mainform. That works great. I guess I want my
cake and to eat it too by having both of the features I described above
working at the same time on the subform. Not sure if this is possible. Here
is the code from my subform:

Private Sub Form_Click()
Dim rec As String

Forms![Permit Limits]![SampLimSub]![Parameter Code].SetFocus

rec = Me.ParmCode

[Forms]![Permit Limits].[PParFrt].SetFocus
DoCmd.FindRecord rec, , True, , True
[Forms]![Permit Limits].[SubLink].SetFocus

End Sub

When the focus is set to “Sublink†on the mainform, it activates the
following code on the mainform, which runs a function (I tried several
methods to get this to work and this combination worked the best):

Private Sub SubLink_GotFocus()
Dim s As String
s = Me.ParmCode
RLink (s)
End Sub

Function RLink(s) As String
[Forms]![Permit Limits].[SampLimSub].SetFocus
DoCmd.FindRecord s, , True, , True
End Function

(I did try to move the subform Click action to the MouseUp action, which
allowed me to select records but didn't work with the record synch because a
record on the subform was not selected until the MouseUp action. Placing the
code in the MouseUp action has the same problem as the Click action) I hope
my explanation is clear.

Thank you for any suggestions or insight you can provide,
Al
 

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