473,513 Members | 2,533 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

help with query (Month as text ) up to given month

I
have a field called year end month where records hold the month financial
year end for accounts is stored.

i need to query the data base and return all records where year end month is
less than or equal to user input (eg april) any ideas

Nov 12 '05 #1
1 1837
Colm,

This might give you some ideas. It's a workaround for your db holding date
information as a text field.

I created a lookup table like this. I called it tblMonths:

MonthNumber MonthName
1 January
2 February
3 March
4 April
5 May
6 June
7 July
8 August
9 September
10 October
11 November
12 December
and a second table like this, which I called tblMonthsAndData :

MonthName Value
April 50
January 34
March 45
November 85
December 90
and then created a form with a combobox (cboMonths) on it and a command
button (cmdGetData).

cboMonths.rowsource = "SELECT [tblMonths].[MonthNumber],
[tblMonths].[MonthName] FROM tblMonths;"
cboMonths Column Count is 2
cboMonths Column Widths is 0";1"
cboMonths List Rows is 12
cboMonth Limit To List is Yes

The user will choose a month from the combobox, the month number is in the
hidden column.

This is the code behind the command button: (Be sure to set a reference to
Microsoft DAO 3.6 Object Library).

Private Sub cmdGetData_Click()
Dim strSQL As String
Dim qdf As QueryDef

On Error Resume Next
CurrentDb.QueryDefs.Delete ("tmpQry")
If Not IsNull(Me!cboMonths) Then
strSQL = "select * from tblMonthsAndData where MonthName in " & _
"(select MonthName from tblMonths where MonthNumber <= " & _
Me!cboMonths & ")"
End If
Set qdf = CurrentDb.CreateQueryDef("tmpQry", strSQL)
DoCmd.OpenQuery "tmpQry"
End Sub

HTH. Linda
"Colm O'Brien" <colmobrien(no spam)@btconnect.com> wrote in message
news:c0**********@sparta.btinternet.com...
I
have a field called year end month where records hold the month financial
year end for accounts is stored.

i need to query the data base and return all records where year end month is less than or equal to user input (eg april) any ideas

Nov 12 '05 #2

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

Similar topics

16
2712
by: cover | last post by:
I have a form with drop down menus to query for name, month, and year to capture activity accordingly by an individual for a given month and given year. But I'd like to also be able to query ALL individiduals for a given month and year OR an individual for the whole year for example. My question, is there any way to have blank (not filled...
4
4285
by: Surendra | last post by:
I have a table that has fields GRP_CODE & END_DATE. For a given GRP_CODE and a given month of a year, there may be 1, 2 or 3 END_DATE values. For Example, GRP_CODE END_DATE AA 07/14/2003 AA 07/28/2003 BB 07/14/2003 BB 07/28/2003 AA 08/01/2003
0
1059
by: Colm O'Brien | last post by:
I have two tables and need help with a query Table 1 is a lookup table fields monthno 1-12 and month name January- December Table 2 lots of fields but 2 important to this query yearendmonth which is jan- dec from table1 and yearendday 1-31 corresponding to day in moth when companies accounts are due. i want to interogate table2 to return...
1
1320
by: ED | last post by:
I am currently developing a database that will spit out job completion stats each day of a given month. I have a table that has lists the number 1 through 31. I am using this as a static table. I have a query that for a given employee lists # of jobs completed, hours worked and other information for everyday of the month. If there is no...
2
2068
by: Bill | last post by:
I have a 200 record database that includes a date/time field, AnnivDate, for a wedding anniversary. AnnivDate has nulls and some incorrect year data. I have been creating the Access database using data imported from an Excel file and the person entering into Excel only cared about the month and day portion and Excel added the current year...
2
3137
by: sorobor | last post by:
dear sir .. i am using cakephp freamwork ..By the way i m begener in php and javascript .. My probs r bellow I made a javascript calender ..there is a close button ..when i press close button then the calender gone actually i want if i click outside off the calender then it should me removed ..How kan i do this ... Pls inform me as early...
2
7252
by: Dinesh | last post by:
Hi experts, I am working on SQL server 2005 reporting services and i am getting a problem in writting a query. Situation is given below. There is one table in database Named Child Now i have to find the All childrens whoes Age is 13 years Base on
17
5646
by: sharsy | last post by:
Hello guys, I would like some help in generating query criteria that will identify credit cards that have expired on an access database. The specific Field is formatted with a Data Type of 'Text' and has an input mask of '00/00', so all expiry dates are set out for example as 10/13 (which represents October 2013). I have hada brief go...
2
1596
by: chungiemo | last post by:
Hi Everybody, I am using Alan Brownes Example of a search form example and I keep getting an error of the following:- Enter Parameter Value Msg Box with the entered Value "Mar" and I re-enter "Mar" the value is displayed. Then the query works. I don't know why this msg box keeps on displaying. Hopefully somebody can help me with this. ...
0
7270
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, 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...
0
7565
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7128
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...
0
7543
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 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...
0
5704
agi2029
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...
0
4759
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...
0
3255
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...
0
1612
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
0
473
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.