Hi,
Below I have two code samples taken from a record editing form. "Record n of n" code is an on current event proceedure for the form. The "Add new record to table" code occurs per a user choice made by clicking a button.
PROBLEM: when a new record is created in the table, I'd like for the "Record n of n" code to state "NEW RECORD" instead of "Record 1 of 9" for example.
Thank you in advance
_________________________________________
"Record n of n" code
__________________________________________
Private Sub Form_Current()
If Me.NewRecord Then
Me!lblNavigate = "New Record"
Else
With Me.RecordsetClone
.Bookmark = Me.Bookmark
Me!lblNavigate = "Record " & Me.CurrentRecord & " of " & Me.Recordset.RecordCount
End With
End If
End Sub
__________________________________________
"Add new record to table" code
__________________________________________
Private Sub Command162_Click()
Dim rstMyRecordset As Recordset
Set rstMyRecordset = CurrentDb.OpenRecordset("Catalog_EFG_DataEntry", dbOpenDynaset)
rstMyRecordset.AddNew
rstMyRecordset.Fields("Subject_Number") = Me.[Subject_Number]
rstMyRecordset.Fields("Subject_Name") = Me.[Subject_Name]
rstMyRecordset.Fields("Document_Name") = Me.[Document_Name]
rstMyRecordset.Update
Set rstMyRecordset = Nothing 'Free Memory
End Sub
Below I have two code samples taken from a record editing form. "Record n of n" code is an on current event proceedure for the form. The "Add new record to table" code occurs per a user choice made by clicking a button.
PROBLEM: when a new record is created in the table, I'd like for the "Record n of n" code to state "NEW RECORD" instead of "Record 1 of 9" for example.
Thank you in advance
_________________________________________
"Record n of n" code
__________________________________________
Private Sub Form_Current()
If Me.NewRecord Then
Me!lblNavigate = "New Record"
Else
With Me.RecordsetClone
.Bookmark = Me.Bookmark
Me!lblNavigate = "Record " & Me.CurrentRecord & " of " & Me.Recordset.RecordCount
End With
End If
End Sub
__________________________________________
"Add new record to table" code
__________________________________________
Private Sub Command162_Click()
Dim rstMyRecordset As Recordset
Set rstMyRecordset = CurrentDb.OpenRecordset("Catalog_EFG_DataEntry", dbOpenDynaset)
rstMyRecordset.AddNew
rstMyRecordset.Fields("Subject_Number") = Me.[Subject_Number]
rstMyRecordset.Fields("Subject_Name") = Me.[Subject_Name]
rstMyRecordset.Fields("Document_Name") = Me.[Document_Name]
rstMyRecordset.Update
Set rstMyRecordset = Nothing 'Free Memory
End Sub