473,385 Members | 1,320 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Sorting Records from ComboBox

I'm working on Microsoft Access. I have a form which views the record of one table. Inside the form, there are several columns. Now I want to sort the records with using combobox. Eg. if the value of the combobox is "Date" then the record is automatically sorted by date itself, if "Name" if chosen then the form will be sorted based on the name...

I'm new to VBA but I've done several SQL...
Thank you...
Apr 5 '06 #1
1 2682
CaptainD
135 100+
Is the form bound or unbound to the database?

If it's unbound, you can set up your query where the order by clause is set by the combobox value.

Select case combobox.text
Case "Date"
sOrderBy = "Order by [Date] ASC"
Case "Last Name"
sOrderBy = "Order by [LName] ASC"
End Select

sSelectString = sSelectString & sOrderBy
Apr 5 '06 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Paul Fairless | last post by:
Customers table - contains Columns: CustID, Surname, Forename, TtlID Titles table - contains Columns: TtlID, Title TtlID is a Foreign Key in the Customers table. I have a Form frmCustomers...
3
by: Pete | last post by:
I have a combobox which is used to select records, which is satisfactory at the moment. However, a second user is going to start using this database and there will be 1600 records. This makes...
2
by: Todd | last post by:
Hi. I want to sort the records on my form (using either a continuous form or a datasheet) by the unbound "description" column in a combo box on the form (or in the datasheet.) Here's a rough...
8
by: Matthew Curiale | last post by:
I am creating an app that lists clients of a company for management of different attributes for that company. The first page is a listing of the companies currently in the database. I have my...
4
by: Michal | last post by:
Hello, Question showed on short example: I got Table with personal information with field 'Name' If in Query based on that Table in 'Criteria' field for 'Name' I put something in '' brackets f.e....
3
by: Jimmy | last post by:
Is there a way to sort/group a report based on the second column of a combo box, i.e. the text associated with the primary key number?
6
by: carlos123 | last post by:
I have a programming assignement that i have been working on for quite some time now. I need your guys' help. My assignement is to great a table with data in it. and it will have a combobox and 2...
1
by: BASSPU03 | last post by:
I've set my combobox to operate according to this option: "Find a record on my form based on a value I selected from my combobox." When I select a value from the combobox, I can see that the...
2
by: kurtzky | last post by:
i created a form that should function as follows: i will enter a number in a textbox..then it should query from the database all the records which has that number..these records will have a...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.