Sort Order

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

Guest

Hi,

I have code in the AfterUpdate event of a Date/Time field (named
"ClockedIn") that increments my Job Number field(named "ReqNo"), starting
with the number 1 at the start of each day. (The code is below, following
this message.)

I would like to have the Job Numbers ordered first by Date/Time, then by Job
Number.

I started with:

Me.OrderBy . . . , but wasn't able to finish the statement.

----------------------

Dim tempDate As String

Me!ClockedIn.Value = Now()
tempDate = Format(Now(), "ddddd")

If DCount("[ReqNo]", "Tasks", "[ClockedIn] > #" & tempDate & "#") = 0 Then
Me.ReqNo = 1
Else
Me.ReqNo = DMax("[ReqNo]", "Tasks", "[ClockedIn] > #" & tempDate & "#") + 1
End If
 
Base your form on a query with the Date/Time field to the left of the Job
Number field. Set the appropriate sorts in these fields.
 
Hi,

Unfortulately the form has already been created. It's based on a table. In
fact, the entire application has been completed. I just happened to notice
this problem, because having the Job Number increment programmically was a
last minute idea I had - it was not part of the original design.

Is there a way I can add code to the existing procedure now to have the jobs
display by date then by job number?

Thanks,
Rosemary


PC Datasheet said:
Base your form on a query with the Date/Time field to the left of the Job
Number field. Set the appropriate sorts in these fields.

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
(e-mail address removed)
www.pcdatasheet.com


Rosemary said:
Hi,

I have code in the AfterUpdate event of a Date/Time field (named
"ClockedIn") that increments my Job Number field(named "ReqNo"), starting
with the number 1 at the start of each day. (The code is below, following
this message.)

I would like to have the Job Numbers ordered first by Date/Time, then by Job
Number.

I started with:

Me.OrderBy . . . , but wasn't able to finish the statement.

----------------------

Dim tempDate As String

Me!ClockedIn.Value = Now()
tempDate = Format(Now(), "ddddd")

If DCount("[ReqNo]", "Tasks", "[ClockedIn] > #" & tempDate & "#") = 0 Then
Me.ReqNo = 1
Else
Me.ReqNo = DMax("[ReqNo]", "Tasks", "[ClockedIn] > #" & tempDate & "#") + 1
End If
 
Changing the recordsource of the form from a table to a query is no big
deal. Open properties and go to the Data tab. Click on the three dots at the
right side of the recordsource property and the wizard will change the
recordsource from the table to a query based on the table. If necessary,
move the date field to the left side of the job number field. Set the sort
on both fields as you need it. All this takes less than a minute!!

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
(e-mail address removed)
www.pcdatasheet.com


Rosemary said:
Hi,

Unfortulately the form has already been created. It's based on a table. In
fact, the entire application has been completed. I just happened to notice
this problem, because having the Job Number increment programmically was a
last minute idea I had - it was not part of the original design.

Is there a way I can add code to the existing procedure now to have the jobs
display by date then by job number?

Thanks,
Rosemary


PC Datasheet said:
Base your form on a query with the Date/Time field to the left of the Job
Number field. Set the appropriate sorts in these fields.

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
(e-mail address removed)
www.pcdatasheet.com


Rosemary said:
Hi,

I have code in the AfterUpdate event of a Date/Time field (named
"ClockedIn") that increments my Job Number field(named "ReqNo"), starting
with the number 1 at the start of each day. (The code is below, following
this message.)

I would like to have the Job Numbers ordered first by Date/Time, then
by
Job
Number.

I started with:

Me.OrderBy . . . , but wasn't able to finish the statement.

----------------------

Dim tempDate As String

Me!ClockedIn.Value = Now()
tempDate = Format(Now(), "ddddd")

If DCount("[ReqNo]", "Tasks", "[ClockedIn] > #" & tempDate & "#") = 0 Then
Me.ReqNo = 1
Else
Me.ReqNo = DMax("[ReqNo]", "Tasks", "[ClockedIn] > #" & tempDate &
"#") +
1
 
That worked -- thank you!!


PC Datasheet said:
Changing the recordsource of the form from a table to a query is no big
deal. Open properties and go to the Data tab. Click on the three dots at the
right side of the recordsource property and the wizard will change the
recordsource from the table to a query based on the table. If necessary,
move the date field to the left side of the job number field. Set the sort
on both fields as you need it. All this takes less than a minute!!

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
(e-mail address removed)
www.pcdatasheet.com


Rosemary said:
Hi,

Unfortulately the form has already been created. It's based on a table. In
fact, the entire application has been completed. I just happened to notice
this problem, because having the Job Number increment programmically was a
last minute idea I had - it was not part of the original design.

Is there a way I can add code to the existing procedure now to have the jobs
display by date then by job number?

Thanks,
Rosemary


PC Datasheet said:
Base your form on a query with the Date/Time field to the left of the Job
Number field. Set the appropriate sorts in these fields.

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
(e-mail address removed)
www.pcdatasheet.com


Hi,

I have code in the AfterUpdate event of a Date/Time field (named
"ClockedIn") that increments my Job Number field(named "ReqNo"), starting
with the number 1 at the start of each day. (The code is below, following
this message.)

I would like to have the Job Numbers ordered first by Date/Time, then by
Job
Number.

I started with:

Me.OrderBy . . . , but wasn't able to finish the statement.

----------------------

Dim tempDate As String

Me!ClockedIn.Value = Now()
tempDate = Format(Now(), "ddddd")

If DCount("[ReqNo]", "Tasks", "[ClockedIn] > #" & tempDate & "#") = 0 Then
Me.ReqNo = 1
Else
Me.ReqNo = DMax("[ReqNo]", "Tasks", "[ClockedIn] > #" & tempDate & "#") +
1
End If
 
Back
Top