473,395 Members | 1,452 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,395 software developers and data experts.

Sorting based on field not in table

Hi!
On a form I give information on produced invoices, sorted by date. Now
I want to have the user be able to choose a range based on the
dat-field. So I make two textboxes (FromDate and ToDate) and have the
user enter a range of dates in these within the dates given in the
datefield. How can I update the form showing only the daterange
(because these fields, FromDate and ToDate are not fields in the
underlying table)? Is there an example out there somewhere?

Kind regards,
Nov 13 '05 #1
4 1178
Geir,

FromDate and ToDate do not have to be fields in the underlying table. Put the
following expression in the criteria of the InvoiceDate field:
Between Forms!NameOfYourForm!FromDate And Forms!NameOfYourForm!ToDate

Between ...And is inclusive; the two specified dates will be included in the
date range.

You can get the invoices for any day by just making the ToDate the same as the
FromDate.

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
re******@pcdatasheet.com
www.pcdatasheet.com
"Geir Baardsen" <al****@start.no> wrote in message
news:9e**************************@posting.google.c om...
Hi!
On a form I give information on produced invoices, sorted by date. Now
I want to have the user be able to choose a range based on the
dat-field. So I make two textboxes (FromDate and ToDate) and have the
user enter a range of dates in these within the dates given in the
datefield. How can I update the form showing only the daterange
(because these fields, FromDate and ToDate are not fields in the
underlying table)? Is there an example out there somewhere?

Kind regards,

Nov 13 '05 #2
"PC Datasheet" <no****@nospam.spam> wrote in message news:<so******************@newsread3.news.atl.eart hlink.net>...
Geir,

FromDate and ToDate do not have to be fields in the underlying table. Put the
following expression in the criteria of the InvoiceDate field:
Between Forms!NameOfYourForm!FromDate And Forms!NameOfYourForm!ToDate

Between ...And is inclusive; the two specified dates will be included in the
date range.

You can get the invoices for any day by just making the ToDate the same as the
FromDate.

Sorry, I forgot to mention that I'm showing the data in a listbox
which is being filled in the form's onload event. So the date-field
will be nr.3 and I can access it through: =lstShowMyData.Column(2).
Nov 13 '05 #3
On 7 Aug 2004 07:50:20 -0700, al****@start.no (Geir Baardsen) wrote:
"PC Datasheet" <no****@nospam.spam> wrote in message news:<so******************@newsread3.news.atl.eart hlink.net>...
Geir,

FromDate and ToDate do not have to be fields in the underlying table. Put the
following expression in the criteria of the InvoiceDate field:
Between Forms!NameOfYourForm!FromDate And Forms!NameOfYourForm!ToDate

Between ...And is inclusive; the two specified dates will be included in the
date range.

You can get the invoices for any day by just making the ToDate the same as the
FromDate.

Sorry, I forgot to mention that I'm showing the data in a listbox
which is being filled in the form's onload event. So the date-field
will be nr.3 and I can access it through: =lstShowMyData.Column(2).


Use the forms Filter property. You could use a button or the after
update event of the ToDate textbox.

Me.Filter = "InvoiceDate Between #" & Me.FromDate & "# And #" _
& Me.ToDate & "#"
Me.FilterOn = True

You would most likely want to validate the entries before applying the
filter.

- Jim
Nov 13 '05 #4
Ji****@datacentricsolutions.com (Jim Allensworth) wrote in message news:<41**************@netnews.comcast.net>...
On 7 Aug 2004 07:50:20 -0700, al****@start.no (Geir Baardsen) wrote:
Use the forms Filter property. You could use a button or the after
update event of the ToDate textbox.

Me.Filter = "InvoiceDate Between #" & Me.FromDate & "# And #" _
& Me.ToDate & "#"
Me.FilterOn = True

You would most likely want to validate the entries before applying the
filter.

- Jim


Hi!
Thank you very much for answering. After a time in a sandbox I found
the following solution:

I have a form and a listbox which is retrieving data in the
form_OnLoad event. So I put
two textboxes, (txtFromDate, txtToDate) and a button, and wrote in the
buttons's OnClick
event:

Private Sub cmdSort_Click()
With Me.lstInvoice
.RowSource = ""
.ColumnCount = 10
.ColumnHeads = True
.ColumnWidths = "2cm;2cm;2cm;2cm;2cm;2cm;3,5cm;2cm;2cm;2cm;"
..RowSource = "SELECT tblOrd.OrdID AS Invoicenr, tblOrd.MyDate,
tblOrd.CustID, tblKunder.Custnr, tblOrd.Printed, tblOrd.Deleted,
tblOrd.DeletedDate, tblOrd.CreditMem, tblOrd.CreditMemnr,
tblOrd.CreditMemDate " _
& "FROM tblCustomer INNER JOIN tblOrd ON tblCustomer.CustID =
tblOrd.CustomerID " _
& "WHERE (((tblOrd.
MyDate) Between Forms!frmMyInvoices!txtFromDate And
Forms!frmMyInvoices!txtToDate));"
End With
End Sub

and of course I have a button that restores the listbox content.
Nov 13 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Raghuram Banda | last post by:
Hi, I was strucked in a problem, basically I'm working on Sortable Table and the table is created using HTML Tags and one of the fields in the table contain Date in unix format (something like...
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...
12
by: pmud | last post by:
Hi, I am using teh following code for sorting the data grid but it doesnt work. I have set the auto generate columns to false. & set the sort expression for each field as the anme of that...
3
by: John Baker | last post by:
Hi: At the outset let me admit that I screwed up! I have built a rather elaborate set of forms and sub forms starting with a client table, and going down to PO and Line item. This works very...
8
by: Mike MacSween | last post by:
tblCourses one to many to tblEvents. A course may have an intro workshop (a type of event), a mid course workshop, a final exam. Or any combination. Or something different in the future. At...
2
by: Neil Hindry | last post by:
I wonder if you can help me. I have been using the very basic functions of Access XP for a while now but I have just started delving into forms etc. I have created a form to enter my data and...
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?
1
by: jjjoic | last post by:
Hi, I use Access 2003 to generate the back-end data for a ColdFusion report at work. The report is sorted by a column and based on the sorting, rankings are assigned to each row(i.e. the biggest...
2
by: Bob Laubla | last post by:
Hello I have a very complex maketable query with many records and involving multiple VB functions which call other functions. I need this table to be sorted by the first field. But no matter what...
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
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...

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.