G
Guest
Morning everyone.
I am trying to use a subform(in datasheet view) to change the parent form's
record using RecordSetClone.
When you click on the record in the subform it changes the parent form
perfectly but since the subform is linked to the main form the selected
record on the subform always goes back to the 1st record.
I am trying to get the subform to stay on the selected record and not go
back to the 1st record. I have got this to work on my other forms but this
one is giving me trouble for some reason and I can't figure out what the
problem is.
Here is the Function I am using for the OnClick on the subform:
Public Function ChangeRecordSet()
strFind = "[StructureID] = " & Forms!StructureInput![Structures
subform]![StructureID] & " And [AreaID] =" & Forms!StructureInput![Structures
subform]![AreaID]
If Not strFind = "[StructureID] = And [AreaID] =" Then
With Forms!StructureInput.RecordsetClone
.FindFirst strFind
If .NoMatch = False Then
Forms!StructureInput.Bookmark = .Bookmark
Forms!StructureInput![Structures subform].Form.Bookmark =
..Bookmark
Else
Beep
End If
End With
Else
Beep
End If
End Function
This line gives the error #3159 - Not a valid Bookmark.
" Forms!StructureInput![Structures subform].Form.Bookmark = .Bookmark "
I have another function that is almost identical that works great.
Public Function ChangeInspRecordSet()
strFind = " [InspID] = " & Forms!StructureInput![Inspections
subform].Form![Inspections subform1]![InspID]
If Not strFind = " [InspID] = " Then
With Forms!StructureInput![Inspections subform].Form.RecordsetClone
.FindFirst strFind
If .NoMatch = False Then
Forms!StructureInput![Inspections subform].Form.Bookmark =
..Bookmark
Forms!StructureInput![Inspections
subform]![Inspectionssubform1].Form.Bookmark = .Bookmark
Else
Beep
End If
End With
Else
Beep
End If
End Function
Any suggestions are greatly appreciated!
Thank You
Joel C.
I am trying to use a subform(in datasheet view) to change the parent form's
record using RecordSetClone.
When you click on the record in the subform it changes the parent form
perfectly but since the subform is linked to the main form the selected
record on the subform always goes back to the 1st record.
I am trying to get the subform to stay on the selected record and not go
back to the 1st record. I have got this to work on my other forms but this
one is giving me trouble for some reason and I can't figure out what the
problem is.
Here is the Function I am using for the OnClick on the subform:
Public Function ChangeRecordSet()
strFind = "[StructureID] = " & Forms!StructureInput![Structures
subform]![StructureID] & " And [AreaID] =" & Forms!StructureInput![Structures
subform]![AreaID]
If Not strFind = "[StructureID] = And [AreaID] =" Then
With Forms!StructureInput.RecordsetClone
.FindFirst strFind
If .NoMatch = False Then
Forms!StructureInput.Bookmark = .Bookmark
Forms!StructureInput![Structures subform].Form.Bookmark =
..Bookmark
Else
Beep
End If
End With
Else
Beep
End If
End Function
This line gives the error #3159 - Not a valid Bookmark.
" Forms!StructureInput![Structures subform].Form.Bookmark = .Bookmark "
I have another function that is almost identical that works great.
Public Function ChangeInspRecordSet()
strFind = " [InspID] = " & Forms!StructureInput![Inspections
subform].Form![Inspections subform1]![InspID]
If Not strFind = " [InspID] = " Then
With Forms!StructureInput![Inspections subform].Form.RecordsetClone
.FindFirst strFind
If .NoMatch = False Then
Forms!StructureInput![Inspections subform].Form.Bookmark =
..Bookmark
Forms!StructureInput![Inspections
subform]![Inspectionssubform1].Form.Bookmark = .Bookmark
Else
Beep
End If
End With
Else
Beep
End If
End Function
Any suggestions are greatly appreciated!
Thank You
Joel C.