473,834 Members | 1,921 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 1859
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 tblMonthsAndDat a :

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.rowso urce = "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_Clic k()
Dim strSQL As String
Dim qdf As QueryDef

On Error Resume Next
CurrentDb.Query Defs.Delete ("tmpQry")
If Not IsNull(Me!cboMo nths) Then
strSQL = "select * from tblMonthsAndDat a where MonthName in " & _
"(select MonthName from tblMonths where MonthNumber <= " & _
Me!cboMonths & ")"
End If
Set qdf = CurrentDb.Creat eQueryDef("tmpQ ry", strSQL)
DoCmd.OpenQuery "tmpQry"
End Sub

HTH. Linda
"Colm O'Brien" <colmobrien(n o spam)@btconnect .com> wrote in message
news:c0******** **@sparta.btint ernet.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
2742
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 in) fields of a query input ignored when left blank? I'm currently doing very successfully what I...
4
4306
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
1072
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 all details up to dategiven eg 4th June so all where month number is < 6 and those where month no is...
1
1331
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 data I have the day set to 0. I am trying to format this query into a report that would look like...
2
2089
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 to the field value. I want to produce a report that shows upcoming anniversaries using a parameter...
2
3159
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 as possible .. I am waiting for ur quick replay ...Here i attached the source code .... <!DOCTYPE...
2
7264
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
5708
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 at trying to work it out, but I was unable to
2
1608
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. A bit more info down below.....
0
9799
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9646
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,...
0
10793
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, 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...
1
10548
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,...
0
9331
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7758
isladogs
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...
0
6954
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();...
0
5627
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...
1
4427
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 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.