J
Jeff
Hi All
I have a form that holds two subform controls.
Subformcontrol 1 is a list of names and refnumbers
subformcontrol 2 is the data for the name or refnumber the user clicks
in subformcontrol 1.
I have code added to the update button on subformcontrol 2 that adds the
data or updates it.
If the data is only being updated, the bookmark updates the info and
refreshes the form maintaining the record visualized and updated.
The problem is when I add a new record. There is no bookmark so when the
form is refreshed, there is no reference to return to the record.
How can I get around this. I've been trying for ages - trial and
error... lots of errors!
Any ideas greatly appreciated,
Jeff
My code is:
Sub listquery()
Dim lngKey As String
Dim aaa As String
lngKey = Nz(Me![AlunoRef], "0")
With Forms![MainForm]!List.Form.RecordsetClone
.FindFirst "AlunoRef = " & lngKey
If Not .NoMatch Then
MsgBox "Data already exists."
Forms![MainForm]!List.Form.Bookmark = .Bookmark
Else
Forms![MainForm].List.Form.Requery
Me.Requery
Problem >>> Forms![MainForm]!List.Form.Bookmark = .Bookmark
MsgBox "New data has been added."
End If
End With
End Sub
' This automatically updates the ref number when a new name is added
becasue the ref number is an autonumber.
Private Sub Nome_Dirty(Cancel As Integer)
Me.AlunoRef.Requery
End Sub
I have a form that holds two subform controls.
Subformcontrol 1 is a list of names and refnumbers
subformcontrol 2 is the data for the name or refnumber the user clicks
in subformcontrol 1.
I have code added to the update button on subformcontrol 2 that adds the
data or updates it.
If the data is only being updated, the bookmark updates the info and
refreshes the form maintaining the record visualized and updated.
The problem is when I add a new record. There is no bookmark so when the
form is refreshed, there is no reference to return to the record.
How can I get around this. I've been trying for ages - trial and
error... lots of errors!
Any ideas greatly appreciated,
Jeff
My code is:
Sub listquery()
Dim lngKey As String
Dim aaa As String
lngKey = Nz(Me![AlunoRef], "0")
With Forms![MainForm]!List.Form.RecordsetClone
.FindFirst "AlunoRef = " & lngKey
If Not .NoMatch Then
MsgBox "Data already exists."
Forms![MainForm]!List.Form.Bookmark = .Bookmark
Else
Forms![MainForm].List.Form.Requery
Me.Requery
Problem >>> Forms![MainForm]!List.Form.Bookmark = .Bookmark
MsgBox "New data has been added."
End If
End With
End Sub
' This automatically updates the ref number when a new name is added
becasue the ref number is an autonumber.
Private Sub Nome_Dirty(Cancel As Integer)
Me.AlunoRef.Requery
End Sub