Hi, I have searched the forum for answers on this and to be honest as a
novice I find it a bit confusing so apologies if it is simple.
There are some searches that I want to apply to my database.
1. To search for all records between 2 dates and display them in a report
2. To be able to show all records which have a selection against them made
from a combo box
3. To be able to combine the two, selecting the option from a combo and then
selecting dates within that
Ok and now in more depth so I can hopefully get across what I mean....
1. I have already made a form with 2 text boxes, all I want to set up is so
that in the first box (startdate) you enter the date and in the second
(enddate) you enter the last date, then by a push on a button it brings up a
report that just shows all the records within those two dates, I can make
standard reports ok and im guessing for this i need some sort of filter, I
just dont know how to do it.
2. In my form I have several drop down boxes that get their info from a table
via a query, when the whole form is saved all the info is stored in a main
table. What i want to be able to do is have another form with a combo (a copy
of one from the main form) and when an item is selected from the combo I can
have a button that will bring up a report of all the records that had that
item selected for it.
3. A combination of two, to be able to 1st select the item and then put two
dates in and get a report of all the records that have the item between the
dates.
I am quite new to this so please keep it simple, im trying to learn but as
you can imagine a lot of this stuff takes time :-)
Thank you loads to anyone that spares the time to help me!
--
Message posted via AccessMonster.c om http://www.accessmonster.com/Uwe/For...ccess/200702/1 7 2417
For part 1, see:
Limiting a Report to a Date Range
at: http://allenbrowne.com/casu-08.html
The example shows how to build the WhereCondition for OpenReport to limit
the report to the dates.
For an example of how to combine the dates with other criteria, see:
Search form - Handle many optional criteria
at: http://allenbrowne.com/ser-62.html
This one is a bit more involved, but it contains a downloadable example that
combines dates, combos, and text boxes. The examples applies the results to
the Filter of a form, but the code is identical to create the WhereCondition
for OpenReport. About 3/4 of the way down the article it shows how to add
one line to apply it to a report.
--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
"evilcowsta re via AccessMonster.c om" <u31650@uwewrot e in message
news:6dab91d5a3 6e8@uwe...
Hi, I have searched the forum for answers on this and to be honest as a
novice I find it a bit confusing so apologies if it is simple.
There are some searches that I want to apply to my database.
1. To search for all records between 2 dates and display them in a report
2. To be able to show all records which have a selection against them made
from a combo box
3. To be able to combine the two, selecting the option from a combo and
then
selecting dates within that
Ok and now in more depth so I can hopefully get across what I mean....
1. I have already made a form with 2 text boxes, all I want to set up is
so
that in the first box (startdate) you enter the date and in the second
(enddate) you enter the last date, then by a push on a button it brings up
a
report that just shows all the records within those two dates, I can make
standard reports ok and im guessing for this i need some sort of filter, I
just dont know how to do it.
2. In my form I have several drop down boxes that get their info from a
table
via a query, when the whole form is saved all the info is stored in a main
table. What i want to be able to do is have another form with a combo (a
copy
of one from the main form) and when an item is selected from the combo I
can
have a button that will bring up a report of all the records that had that
item selected for it.
3. A combination of two, to be able to 1st select the item and then put
two
dates in and get a report of all the records that have the item between
the
dates.
I am quite new to this so please keep it simple, im trying to learn but as
you can imagine a lot of this stuff takes time :-)
Thank you loads to anyone that spares the time to help me!
--
Message posted via AccessMonster.c om http://www.accessmonster.com/Uwe/For...ccess/200702/1
Hi Thanks very much for the links they are really good. Just one problem I
have is that In the 1st link I am using Method 2, I have followed it through
but when I click OK in the form nothing happens. Im probably being thick but
what am I missing, the report doesnt open, should that open based on the code
it says to use? or do i need to open the report then run the code, at which
point how do i do that if the code is already in the OnClick?
My Report is called : Date Report
The field on the report containing the date is called: Date Job Received
The Code is.....
Option Compare Database
Private Sub Command4_Click( )
Dim strReport As String 'Name of report to open.
Dim strField As String 'Name of your date field.
Dim strWhere As String 'Where condition for OpenReport.
Const conDateFormat = "\#mm\/dd\/yyyy\#"
strReport = "Date Report"
strField = "Date Job Received"
If IsNull(Me.txtSt artDate) Then
If Not IsNull(Me.txtEn dDate) Then 'End date, but no start.
strWhere = strField & " <= " & Format(Me.txtEn dDate,
conDateFormat)
End If
Else
If IsNull(Me.txtEn dDate) Then 'Start date, but no End.
strWhere = strField & " >= " & Format(Me.txtSt artDate,
conDateFormat)
Else 'Both start and end dates.
strWhere = strField & " Between " & Format(Me.txtSt artDate,
conDateFormat) _
& " And " & Format(Me.txtEn dDate, conDateFormat)
End If
End If
' Debug.Print strWhere 'For debugging purposes only.
DoCmd.OpenRepor t strReport, acViewPreview, , strWhere
End Sub
Private Sub Command5_Click( )
DoCmd.Close acForm, Me.Name
End Sub
Private Sub OK_Click()
End Sub
Any Ideas what im missing?
Thank You
Allen Browne wrote:
>For part 1, see:
Limiting a Report to a Date Range at: http://allenbrowne.com/casu-08.html The example shows how to build the WhereCondition for OpenReport to limit the report to the dates.
For an example of how to combine the dates with other criteria, see:
Search form - Handle many optional criteria at: http://allenbrowne.com/ser-62.html This one is a bit more involved, but it contains a downloadable example that combines dates, combos, and text boxes. The examples applies the results to the Filter of a form, but the code is identical to create the WhereCondition for OpenReport. About 3/4 of the way down the article it shows how to add one line to apply it to a report.
>Hi, I have searched the forum for answers on this and to be honest as a novice I find it a bit confusing so apologies if it is simple.
[quoted text clipped - 39 lines]
>> Thank you loads to anyone that spares the time to help me!
--
Message posted via http://www.accessmonster.com
Hi Thanks very much for the links they are really good. Just one problem I
have is that In the 1st link I am using Method 2, I have followed it through
but when I click OK in the form nothing happens. Im probably being thick but
what am I missing, the report doesnt open, should that open based on the code
it says to use? or do i need to open the report then run the code, at which
point how do i do that if the code is already in the OnClick?
My Report is called : Date Report
The field on the report containing the date is called: Date Job Received
The Code is.....
Option Compare Database
Private Sub Command4_Click( )
Dim strReport As String 'Name of report to open.
Dim strField As String 'Name of your date field.
Dim strWhere As String 'Where condition for OpenReport.
Const conDateFormat = "\#mm\/dd\/yyyy\#"
strReport = "Date Report"
strField = "Date Job Received"
If IsNull(Me.txtSt artDate) Then
If Not IsNull(Me.txtEn dDate) Then 'End date, but no start.
strWhere = strField & " <= " & Format(Me.txtEn dDate,
conDateFormat)
End If
Else
If IsNull(Me.txtEn dDate) Then 'Start date, but no End.
strWhere = strField & " >= " & Format(Me.txtSt artDate,
conDateFormat)
Else 'Both start and end dates.
strWhere = strField & " Between " & Format(Me.txtSt artDate,
conDateFormat) _
& " And " & Format(Me.txtEn dDate, conDateFormat)
End If
End If
' Debug.Print strWhere 'For debugging purposes only.
DoCmd.OpenRepor t strReport, acViewPreview, , strWhere
End Sub
Private Sub Command5_Click( )
DoCmd.Close acForm, Me.Name
End Sub
Private Sub OK_Click()
End Sub
Any Ideas what im missing?
Thank You.
Allen Browne wrote:
>For part 1, see:
Limiting a Report to a Date Range at: http://allenbrowne.com/casu-08.html The example shows how to build the WhereCondition for OpenReport to limit the report to the dates.
For an example of how to combine the dates with other criteria, see:
Search form - Handle many optional criteria at: http://allenbrowne.com/ser-62.html This one is a bit more involved, but it contains a downloadable example that combines dates, combos, and text boxes. The examples applies the results to the Filter of a form, but the code is identical to create the WhereCondition for OpenReport. About 3/4 of the way down the article it shows how to add one line to apply it to a report.
>Hi, I have searched the forum for answers on this and to be honest as a novice I find it a bit confusing so apologies if it is simple.
[quoted text clipped - 39 lines]
>> Thank you loads to anyone that spares the time to help me!
--
Message posted via AccessMonster.c om http://www.accessmonster.com/Uwe/For...ccess/200702/1
The report should open.
The field contains spaces in its name, so will need square brackets around
it, like this:
strField = "[Date Job Received]"
Immediately above the DoCmd.OpenRepor t line, remove the single quote from
the start of the Debug.Print line. On the next line, enter:
Stop
When the button clicks, it should stop at this line. (If it doesn't the code
is not executing at all.) Then press Ctrl+G to open the Immediate Window and
see what was written there. It should be just like the WHERE clause in a
query. Then press F8 to single-step through the routine. Does the
DoCmd.OpenRepor t line get hightlighted? Then does the report open? If not,
is something cancelling it? The NoData event perhaps?
--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
"evilcowsta re via AccessMonster.c om" <u31650@uwewrot e in message
news:6db5b9984b 220@uwe...
Hi Thanks very much for the links they are really good. Just one problem I
have is that In the 1st link I am using Method 2, I have followed it
through
but when I click OK in the form nothing happens. Im probably being thick
but
what am I missing, the report doesnt open, should that open based on the
code
it says to use? or do i need to open the report then run the code, at
which
point how do i do that if the code is already in the OnClick?
My Report is called : Date Report
The field on the report containing the date is called: Date Job Received
The Code is.....
Option Compare Database
Private Sub Command4_Click( )
Dim strReport As String 'Name of report to open.
Dim strField As String 'Name of your date field.
Dim strWhere As String 'Where condition for OpenReport.
Const conDateFormat = "\#mm\/dd\/yyyy\#"
strReport = "Date Report"
strField = "Date Job Received"
If IsNull(Me.txtSt artDate) Then
If Not IsNull(Me.txtEn dDate) Then 'End date, but no start.
strWhere = strField & " <= " & Format(Me.txtEn dDate,
conDateFormat)
End If
Else
If IsNull(Me.txtEn dDate) Then 'Start date, but no End.
strWhere = strField & " >= " & Format(Me.txtSt artDate,
conDateFormat)
Else 'Both start and end dates.
strWhere = strField & " Between " & Format(Me.txtSt artDate,
conDateFormat) _
& " And " & Format(Me.txtEn dDate, conDateFormat)
End If
End If
' Debug.Print strWhere 'For debugging purposes only.
DoCmd.OpenRepor t strReport, acViewPreview, , strWhere
End Sub
Private Sub Command5_Click( )
DoCmd.Close acForm, Me.Name
End Sub
Private Sub OK_Click()
End Sub
Any Ideas what im missing?
Thank You.
Allen Browne wrote:
>>For part 1, see: Limiting a Report to a Date Range at: http://allenbrowne.com/casu-08.html The example shows how to build the WhereCondition for OpenReport to limit the report to the dates.
For an example of how to combine the dates with other criteria, see: Search form - Handle many optional criteria at: http://allenbrowne.com/ser-62.html This one is a bit more involved, but it contains a downloadable example that combines dates, combos, and text boxes. The examples applies the results to the Filter of a form, but the code is identical to create the WhereConditio n for OpenReport. About 3/4 of the way down the article it shows how to add one line to apply it to a report.
>>Hi, I have searched the forum for answers on this and to be honest as a novice I find it a bit confusing so apologies if it is simple.
[quoted text clipped - 39 lines]
>>> Thank you loads to anyone that spares the time to help me!
--
Message posted via AccessMonster.c om http://www.accessmonster.com/Uwe/For...ccess/200702/1
Ok added the [ ] to the names, wrote Stop below Debug.Print strWhere
Still didnt do anything.
When I click the runsub/user button it brings up a macro box with macro name
at the top, if i type anything in i get the option to click create.
I brought up the Immediate area and there is nothing in it
Maybe there is an easier way to bring up a report and filter it between 2
different dates?
Allen Browne wrote:
>The report should open.
The field contains spaces in its name, so will need square brackets around it, like this:
strField = "[Date Job Received]"
Immediately above the DoCmd.OpenRepor t line, remove the single quote from the start of the Debug.Print line. On the next line, enter:
Stop
> When the button clicks, it should stop at this line. (If it doesn't the code is not executing at all.) Then press Ctrl+G to open the Immediate Window and see what was written there. It should be just like the WHERE clause in a query. Then press F8 to single-step through the routine. Does the DoCmd.OpenRepo rt line get hightlighted? Then does the report open? If not, is something cancelling it? The NoData event perhaps?
>Hi Thanks very much for the links they are really good. Just one problem I have is that In the 1st link I am using Method 2, I have followed it
[quoted text clipped - 80 lines]
>>>> Thank you loads to anyone that spares the time to help me!
--
Message posted via http://www.accessmonster.com
If the code is not running, it's not connected to your button.
Open the form in design view.
Right-click the command button, and choose Properties.
Set the On Click property to [Event Procedure]
Click the Build button (...) beside that.
Access opens the code window.
The code should be in there.
--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
"evilcowsta re via AccessMonster.c om" <u31650@uwewrot e in message
news:6dc0b95d8d 7e6@uwe...
Ok added the [ ] to the names, wrote Stop below Debug.Print strWhere
Still didnt do anything.
When I click the runsub/user button it brings up a macro box with macro
name
at the top, if i type anything in i get the option to click create.
I brought up the Immediate area and there is nothing in it
Maybe there is an easier way to bring up a report and filter it between 2
different dates?
Allen Browne wrote:
>>The report should open.
The field contains spaces in its name, so will need square brackets around it, like this: strField = "[Date Job Received]"
Immediately above the DoCmd.OpenRepor t line, remove the single quote from the start of the Debug.Print line. On the next line, enter: Stop
>> When the button clicks, it should stop at this line. (If it doesn't the code is not executing at all.) Then press Ctrl+G to open the Immediate Window and see what was written there. It should be just like the WHERE clause in a query. Then press F8 to single-step through the routine. Does the DoCmd.OpenRep ort line get hightlighted? Then does the report open? If not, is something cancelling it? The NoData event perhaps?
>>Hi Thanks very much for the links they are really good. Just one problem I have is that In the 1st link I am using Method 2, I have followed it
[quoted text clipped - 80 lines]
>>>>> Thank you loads to anyone that spares the time to help me!
Hi, the event procedure was there, but after I looked at your reply I started
to look properly into and noticed that on the drop down box on the left in VB
in said (general) no the "ok" button.
Changed it over, now works fab. Thank you very much for the kick to the head :
-)
Allen Browne wrote:
>If the code is not running, it's not connected to your button.
Open the form in design view. Right-click the command button, and choose Properties. Set the On Click property to [Event Procedure] Click the Build button (...) beside that. Access opens the code window. The code should be in there.
>Ok added the [ ] to the names, wrote Stop below Debug.Print strWhere Still didnt do anything.
[quoted text clipped - 32 lines]
>>>>>> >Thank you loads to anyone that spares the time to help me!
--
Message posted via AccessMonster.c om http://www.accessmonster.com/Uwe/For...ccess/200702/1 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: donald |
last post by:
Hi all, I have a website running asp (about to move to asp.net soon though)
which has a list of DVD's I have the various pages I want, last 10, listing,
full listing ect, but the one page i can't figure out is a search page.
I have read various books, but none have given any tips on how to make a
search page for a access DB.
Could someone point me to a tutorial?
Thanks
|
by: Saso Zagoranski |
last post by:
Hi!
This is not exactly a C# question but I don't know where else to post it...
I'm making an application where the user keeps track of it's art
collection... I'm also trying
to implement a search, where the user could search specific arts based on
defined criteria.
The problem is when it comes to date of origin. The year of an artwork could
be 1970, 1982 or 1780 but it could also be 16. century or something
|
by: bluelaser |
last post by:
Hi there, i'm developing an asp.net page which contains 3 drop down
boxes each for day, month and year. The problem i have is i need to
ensure that the dates the user selects must be within a certain date
range. For eg, it has to be between 1 Dec 2005 to 1 May 2006. It seems
that the validation controls provided isn't sufficient to do the job
for me. Can anyone give me a solution to this problem? BTW, i'm using
C#.
|
by: rugger81 |
last post by:
I am currently working in the sql server 2000 environment and I want to
write a function to pull all dates within a given date range. I have
created several diferent ways to do this but I am unsatisfied with
them. Here is what I have so far:
declare @Sdate as datetime
declare @Edate as datetime
set @SDate = '07/01/2006'
set @EDate = '12/31/2006'
|
by: justobservant |
last post by:
When more than one keyword is typed into a search-query, most of the
search-results displayed indicate specified keywords scattered
throughout an entire website of content i.e., this is shown as three
bolded periods '...' in search-result listings.
Additionally, most content is outdated; as many users need up-to-date
content. Hence, filtering-through search-results becomes quite
cumbersome.
The newsgroup listings allow detailed...
| |
by: soni2926 |
last post by:
Hi,
I have a web application, asp.net and c# done in 2.0, which is going
to return rows from the db with dates or certain events. The db is
going to have events dates for the entire year, but on the site we
just want those events for the current month. Is there a way to check
this, check as each date is returned if it falls under the current
month, year?
Thanks.
|
by: hempknight |
last post by:
Hi! all
this is probably been answered in part elsewhere but does anyone know how to get Dates that are 30 days from the current date on the system?
my Database has a field to hold the Warranty End Date for a computer system.
the user can either Enter "N/A" or a Date in this format dd/mm/yy anything else and it should popup a msgbox indicating a problem.
to allow the use of N/A and the "/" in the Date i set it to text field and even...
|
by: dennisfreud |
last post by:
Hi,
I am looking for general help here. I dont know how to start at this... maybe someone can point me in the right direction.
I need to calculate how many nights of a given time frame (variable dates) lie within certain ranges of times given to calcutate pricing for a hotel which has different prices depending on the season. (fixed dates).
So I have this table (MYSQL) which for example says:
from : to : price/night
01/01 :...
|
by: =?Utf-8?B?QnJ5YW4=?= |
last post by:
Hello group.
I've migrated from Win 2003 server to Win 2008 server.
I've been banging my head agaist a wall for several days now trying to
figure this out.
I have the following script that will search the file system and return file
names of all files within a folder and subfolders that meet the search
criteria of DateLastModified.
To test the output, you can use the following link:
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
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: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |