New records "batch" log

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have created a tab on a data entry form that I would like to populate with
the new records that are entered. In other words as the data entry person
adds records they are displayed in the tab field below showing a summary of
the data they have already entered. How can I code this tab to display only
these new records after they are entered?

Thanks.
 
On open event of your form you could count the total of records and
keep the value to a variable as like
Dim intOldTotalOfRecords As Integer
intTotalOfOldRecords = Me.RecordsetClone.RecordCount
Then on current event you make the subtraction
(Me.RecordsetClone.RecordCount - intTotalOfOldRecords) + 1
 
Do I place the code in the main form where the data entry fields are, or in
the subform where I would like the new records to be displayed? If it goes in
the subform the only events I have are, On Enter and On Exit. I have already
tried adding the code to my Main forms Open event and current event, but the
current event gave me an error and didn't like (Me.RecordsetClone.RecordCount
- intTotalofOldRecords) + 1. I have tried this both with and without parens.
 
Sorry i misunderstood your question, I though you wanted to count the
new records that are entered every time the user opens the data entry
form and show the total of new records in a textbox.
There must be many ways to do what you want.
You could create a field [OldRecord](True/False) in your table and
everytime the user opens the form to run an update query for set the
existing records old ([OldRecord]=True).
Then you could create a query that select all the records that have
the field [OldRecord]=False and set this query as the recordsource of
your subform.
SELECT *
FROM TableName
WHERE (((TableName.OldRecord)=False));

You dont have to link the main form with the subform.

Private Sub Form_Open(Cancel As Integer)
Dim dbs As Database
Set dbs = CurrentDb
dbs.Execute "UPDATE TableName SET OldRecord=True;"
dbs.Close
Set dbs = Nothing
End Sub

Private Sub Form_Current()
Me.NameOfSubform.Requery
End Sub
 

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

Back
Top