I inherited an Access 2003 database and need to change the way a form is sorted. It seems to work like this. There is a table containing work records of work requests. The user fills out a form requesting the work and it is assigned a number using the autonumber feature and the date is also put in automatically, then it is entered in the table. There is another form that other users use to request all records designated as new. The form, via a macro, returns all the records. Somehow it stopped sorting by the autonumber. I tried selecting different fields while the form was in run mode (not design view) but could not select the fields date or autonumber. I can only sort on fields that contain user entered data. Does anyone know how to change this so it always sorts on either autonumber(pref erably) or date? When I run a query against the table it sorts by these fields fine, but I don't want to rebuild the whole thing and would rather get the form to work as it used to when called by the macro.
Thanks for your help.
3 6142
I inherited an Access 2003 database and need to change the way a form is sorted. It seems to work like this. There is a table containing work records of work requests. The user fills out a form requesting the work and it is assigned a number using the autonumber feature and the date is also put in automatically, then it is entered in the table. There is another form that other users use to request all records designated as new. The form, via a macro, returns all the records. Somehow it stopped sorting by the autonumber. I tried selecting different fields while the form was in run mode (not design view) but could not select the fields date or autonumber. I can only sort on fields that contain user entered data. Does anyone know how to change this so it always sorts on either autonumber(pref erably) or date? When I run a query against the table it sorts by these fields fine, but I don't want to rebuild the whole thing and would rather get the form to work as it used to when called by the macro.
Thanks for your help.
Try placing this code in the load event of the form: Replace "YourAutoNumber Field" with the fields actual Name -
Private Sub Form_Load()
-
-
On Error GoTo ErrorHandler
-
-
Me.OrderBy = "YourAutoNumberField"
-
-
Me.OrderByOn = True ' Apply the sort order.
-
-
Exit Sub
-
-
ErrorHandler:
-
MsgBox "Error #: " & Err.Number & vbCrLf & vbCrLf & Err.Description
-
End Sub
Thanks for your help, that worked!
I was not able to sort a report by date, either. My SQL was set up to sort a report based on a document name and the date but would only sort by the document name: -
SELECT ID, Name, Date
-
FROM Documents Doc
-
WHERE Name <> ""
-
ORDER BY Doc.Name, Doc.Date;
My report output looked sumtin like dis:
Document 100 5/5/2007
Document 200 6/4/2007
Document 300 5/28/2007
I eliminated the ORDER BY clause from my SQL and played with the report's "Sorting and Grouping" button and that produced the same results. I then swapped the date and name ordering and it worked. For some reason I had to have the date sorted first then the document name. As usual, I don't understand why this worked but in my case whatever combination of keypresses makes database go me happy (or at least ameliorated).
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Nova's Taylor |
last post by:
Hi folks,
I am a newbie to Python and am hoping that someone can get me started
on a log parser that I am trying to write.
The log is an ASCII file that contains a process identifier (PID),
username, date, and time field like this:
1234 williamstim 01AUG03 7:44:31
2348 williamstim 02AUG03 14:11:20
|
by: Matt |
last post by:
Hi all,
We recently upsized two Microsoft Access Databases to SQL. We're
using an ADP (2002) as the front end.
All the conversion issues have been resolved, except for one:
Whenever we insert a record into a table, the table isn't sorted by
primary key like I would expect. Instead, the record can be found at
the end of the table. This makes finding a particular record
(especially as time goes on) very difficult.
|
by: Elijah Bailey |
last post by:
I want to sort a set of records using STL's sort() function,
but dont see an easy way to do it.
I have a
char *data;
which has size mn bytes where m is size of the record and
n is the number of records. Both these numbers are known
|
by: Bill Reid |
last post by:
Hello,
I am a just-beyond-beginning user of Access 97 on a Windows 98se
machine (a single, non-networked home machine). All of a sudden I am
unable to sort any of my tables. I click on any random heading to
select the column, but the A\Z and Z\A buttons in the toolbar stay
grayed out. This happens for any column on any table. I even created
a test table since I first noticed this problem, but it also is not
sort-able. I haven't...
|
by: Nhmiller |
last post by:
This is directly from Access' Help:
"About designing a query
When you open a query in Design view, or open a form, report, or datasheet and
show the Advanced Filter/Sort window (Advanced Filter/Sort window: A window in
which you can create a filter from scratch. You enter criteria expressions in
the filter design grid to restrict the records in the open form or datasheet to
a subset of records that meet the criteria.), you see the design...
| |
by: Marie |
last post by:
My report has a text field named ItemNum. Most records have a value for
ItemNum. I set Grouping And Sorting to sort ascending on the ItemNum field.
The records where ItemNum is Null appear at the top of the list in the
report. I want the records that have a value for ItemNum to be first in the
report and sorted ascending and I want the records where ItemNum is Null to
be at the end of the report. How do I do this?
Thanks for all help!
...
|
by: mcollier |
last post by:
I have some VB6 code that calls a SELECT query in Microsoft Access.
When I run the query from access, the results appear in not particular
order. However, when I call the query from VB6, via ADO, the rows are
returned in order by one particular column/field. There is no ORDER BY
on the query.
For example, in Access, the rows may be returned as:
RowID
------
1
|
by: brucedodds |
last post by:
I have a client who has just migrated from Access 97 to Access XP. He
uses make-table queries to sort tables by two fields (text & double)
before exporting the records for another application.
In Access XP (SP2) the make-table sort works correctly on the first
sort field (text), but the second field (double) is not in sequence.
Oddly, when the make-table query is viewed in datasheet view, the sort
is correct. It's a large table (206K...
|
by: Chris Zoper |
last post by:
Hello,
I have a form that shows a lot of records based on a passthrough query
to a SQL Server database. I noticed that the Filter and the Sort
property of the form do not properly work, often the filter and sorting
are not performed. When I base the form on a query on an Access-table
everything works just fine, but when I use the passthrough query
nothing happens.
Does anyone know how to solve this problem?
|
by: muskie |
last post by:
I've looked through as many posts about this as possible, but all end
with no resolution. I simply need records from a table in random
order, and I will be calling this recordset in a SQL statement from
ASP. I've tried the following but it does not produce random order:
SELECT * FROM Table1 ORDER BY Rnd(TableID) ASC;
where TableID is an autonumber field.
I've seen references to Randomize, but how do you use Access's
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |