D
DavidAtCaspian
This one caused me a few problems.
I have a form /subform where sometimes I want to link by Surname alone, and
sometimes by Surname AND first name. The difference is selected by command
button.
BUT every time I change, as soon as it get to the first one, up comes a
message saying that both links must be the same number of fields.
The error comes up before it gets to the second line, which does indeed have
the same number of fields as the first.
The solution, (which I haven't seen on the boards) is to repeat line 1 in
postions 3, and put in an error trap that simply says Resume Next.
Up comes the error. Resume next ignores the error line and runs the second
line (which records that both links have the same number of records). and the
third line implements what the first one couldn't.
Not sure if Microsoft would regard this as a bug or not. But it does the job.
Example:
Private Sub cmdFindByName_Click()
On Error GoTo Trap:
Me.subUnMatchedWGHEpisodes.LinkMasterFields = "Surname"
Me.subUnMatchedWGHEpisodes.LinkChildFields = "Surname"
Me.subUnMatchedWGHEpisodes.LinkMasterFields = "Surname"
Exit Sub
Trap:
Resume Next
End Sub
__________________________________________________
Private Sub cmdFullName_Click()
On Error GoTo Trap:
Me.subUnMatchedWGHEpisodes.LinkMasterFields = "Surname,Forename"
Me.subUnMatchedWGHEpisodes.LinkChildFields = "Surname,Forename"
Me.subUnMatchedWGHEpisodes.LinkMasterFields = "Surname,Forename"
Trap:
Resume Next
End Sub
I have a form /subform where sometimes I want to link by Surname alone, and
sometimes by Surname AND first name. The difference is selected by command
button.
BUT every time I change, as soon as it get to the first one, up comes a
message saying that both links must be the same number of fields.
The error comes up before it gets to the second line, which does indeed have
the same number of fields as the first.
The solution, (which I haven't seen on the boards) is to repeat line 1 in
postions 3, and put in an error trap that simply says Resume Next.
Up comes the error. Resume next ignores the error line and runs the second
line (which records that both links have the same number of records). and the
third line implements what the first one couldn't.
Not sure if Microsoft would regard this as a bug or not. But it does the job.
Example:
Private Sub cmdFindByName_Click()
On Error GoTo Trap:
Me.subUnMatchedWGHEpisodes.LinkMasterFields = "Surname"
Me.subUnMatchedWGHEpisodes.LinkChildFields = "Surname"
Me.subUnMatchedWGHEpisodes.LinkMasterFields = "Surname"
Exit Sub
Trap:
Resume Next
End Sub
__________________________________________________
Private Sub cmdFullName_Click()
On Error GoTo Trap:
Me.subUnMatchedWGHEpisodes.LinkMasterFields = "Surname,Forename"
Me.subUnMatchedWGHEpisodes.LinkChildFields = "Surname,Forename"
Me.subUnMatchedWGHEpisodes.LinkMasterFields = "Surname,Forename"
Trap:
Resume Next
End Sub