Sorting records on a continous form

T

Tony Williams

I have a continuous sub form, based on a table Actionlog that is used as an
Action Log. There are 4 controls
Action Log - text
Timedate - based on Time/Date field of same name
Log Date - =Format([TimeDate],"dd-mm-yy")
Log Time - =Format([TimeDate],"hh:nn AM/PM")

The Event procedures for the sub form are:
Private Sub Action_Log_AfterUpdate()
If Me.NewRecord Then
Me.TimeDate = Now
End If
End Sub

Private Sub Form_Current()
If Me.NewRecord Then
Me.Action_Log.Locked = False
Else
Me.Action_Log.Locked = True
End If
End Sub

As the user inputs new data into the ActionLog control the date and time is
automatically entered in Log Date and Log Time.

In nearly all the records the entries for Action Log are sorted in date/time
order. In a few records odd entries appear out of sequence. I've sorted the
table by the TimeDate field but that hasn't made any difference. As the
controls are calculated it can't be the user making an input error.
Can anyone suggest what might be going wrong?
Thanks
Tony
 
S

Steve Schapel

Tony,

First of all, I would suggest the Action_Log_AfterUpdate code can be
dispensed with, as you can simply set the Default Value of the TimeDate
control to:
Now()

I would suggest, instead of the form being based directly on the
Actionlog table, you could change the Record Source of the form to a
query like this:
SELECT * FROM Actionlog ORDER BY TimeDate
 
T

Tony Williams

Thanks Steve sorry for the delay in replying. Took your advice and used a
query, worked a treat.
Cheers
Tony
Steve Schapel said:
Tony,

First of all, I would suggest the Action_Log_AfterUpdate code can be
dispensed with, as you can simply set the Default Value of the TimeDate
control to:
Now()

I would suggest, instead of the form being based directly on the Actionlog
table, you could change the Record Source of the form to a query like
this:
SELECT * FROM Actionlog ORDER BY TimeDate

--
Steve Schapel, Microsoft Access MVP

Tony said:
I have a continuous sub form, based on a table Actionlog that is used as
an Action Log. There are 4 controls
Action Log - text
Timedate - based on Time/Date field of same name
Log Date - =Format([TimeDate],"dd-mm-yy")
Log Time - =Format([TimeDate],"hh:nn AM/PM")

The Event procedures for the sub form are:
Private Sub Action_Log_AfterUpdate()
If Me.NewRecord Then
Me.TimeDate = Now
End If
End Sub

Private Sub Form_Current()
If Me.NewRecord Then
Me.Action_Log.Locked = False
Else
Me.Action_Log.Locked = True
End If
End Sub

As the user inputs new data into the ActionLog control the date and time
is automatically entered in Log Date and Log Time.

In nearly all the records the entries for Action Log are sorted in
date/time order. In a few records odd entries appear out of sequence.
I've sorted the table by the TimeDate field but that hasn't made any
difference. As the controls are calculated it can't be the user making an
input error.
Can anyone suggest what might be going wrong?
Thanks
Tony
 

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

Top