473,398 Members | 2,403 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,398 software developers and data experts.

textbox and query

Hi
I have the code below that allows me to test the result of a query
The query is a crosstab and pivots on months
what i want to do is check if the field december is different to blank
and if so increment the textbox.
the problem is
1. if no value for december the field is not included in the result
2. assuming i can get over 1st problem how can i check if field
december is different to space?

Dim db As DAO.Database
Dim qd As DAO.QueryDef
Dim rs As DAO.Recordset
Set db = CurrentDb
Set qd = db.QueryDefs("monthly_totals_team")
Set rs = qd.OpenRecordset()

If Not rs.EOF <> 0 Then
Me.Cboyears = Me.Cboyears + 1
End If
On Error Resume Next
Set rs = Nothing
Set qd = Nothing
Set db = Nothing
thanks

kevin
Nov 13 '05 #1
2 1754

"Kevin" <ke******@btinternet.com> wrote in message
news:9f**************************@posting.google.c om...
Hi
I have the code below that allows me to test the result of a query
The query is a crosstab and pivots on months
what i want to do is check if the field december is different to blank
and if so increment the textbox.
the problem is
1. if no value for december the field is not included in the result
2. assuming i can get over 1st problem how can i check if field
december is different to space?

Dim db As DAO.Database
Dim qd As DAO.QueryDef
Dim rs As DAO.Recordset
Set db = CurrentDb
Set qd = db.QueryDefs("monthly_totals_team")
Set rs = qd.OpenRecordset()

If Not rs.EOF <> 0 Then
Me.Cboyears = Me.Cboyears + 1
End If
On Error Resume Next
Set rs = Nothing
Set qd = Nothing
Set db = Nothing
thanks

kevin

We can't see the SQL for the query, so do you mean that "December" might, or
might not, be a column heading? If so, what row do you need to locate, or
is there only one?
In general, you could use the .FindFirst method of the recordset if there is
more than one row, then check for the .NoMatch condition to see if you have
located the correct row. Once you have the right row, you can evaluate
Len(Trim(Nz(rst.Fields("December"),""))) to see whether it is null, blank or
a space. Of course if the column December does not exist, you have to catch
the error 3265 Item not found in this collection.


Nov 13 '05 #2
Kevin,
If I do understand your question correctly, then I think you need to 'force' your columns
to appear in the resultset.
How? Just put the ColumnHeadings in the properties of your query.
In your sql it would look like:
Transform .... Select .... FROM .... GROUPBY .....PIVOT Month In("jan","feb",
......,"dec");

--
Hope this helps
Arno R
"Kevin" <ke******@btinternet.com> schreef in bericht
news:9f**************************@posting.google.c om...
Hi
I have the code below that allows me to test the result of a query
The query is a crosstab and pivots on months
what i want to do is check if the field december is different to blank
and if so increment the textbox.
the problem is
1. if no value for december the field is not included in the result
2. assuming i can get over 1st problem how can i check if field
december is different to space?

Dim db As DAO.Database
Dim qd As DAO.QueryDef
Dim rs As DAO.Recordset
Set db = CurrentDb
Set qd = db.QueryDefs("monthly_totals_team")
Set rs = qd.OpenRecordset()

If Not rs.EOF <> 0 Then
Me.Cboyears = Me.Cboyears + 1
End If
On Error Resume Next
Set rs = Nothing
Set qd = Nothing
Set db = Nothing
thanks

kevin

Nov 13 '05 #3

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

Similar topics

2
by: Jeroen van vliet | last post by:
Hello How can i run a query from a mdb database and show it in a datagrid control when i put in a letter in a textbox? for instance. when i type the letter "A" in the textbox i want to run a...
5
by: Steve | last post by:
I have an unbound combobox in the form header of a continuous form. The selection in the combobox sets the where clause in a querydef which determines QryPFrmInventoryManagement. The following code...
0
by: Paul Rees | last post by:
I am wondering if anyone has encountered a similar problem to the one that I am having. I have an ASP.NET page which has a table and a dropdownlist that was added at design time. The majority of...
11
by: Joe | last post by:
Hello All, I have an ASP.NET page with one Textbox (SearchTextBox) and one ImageButton (SearchButton) server controls. The user can type search text in SearchTextBox and click SearchButton and...
2
by: | last post by:
Hi everyone, I have a form with a combo box on it. When you select a value (a PO#) from the combo box, the bound field is the indexID of the selected PO. On the same form, I have a text box...
6
by: Drum2001 | last post by:
I have a database where I need to query multiple items. Is it possible to run a query based on a textbox where the information is delimited by a comma. Example: Show me all names where...
3
by: DHarris | last post by:
I created a continuous form in Access2003 based on a query that users review customers and once reviewed clicks on a command button that executes an append query to update a table of the reviewed...
3
by: Richard | last post by:
How is the result of query placed in a unbound textbox ? Suppose CriteriaLookups has columns TableName, KeyColumn, KeyValue, DataColumn Foo,x,11,xhat Bar,z,3,xyzzy And
0
by: mamun | last post by:
Hi All, I have the following situation. I have 10 rows in a form. In each row there are six textbox controls. The users can enter any number of rows of records (either none or upto 10). I...
1
by: viral123 | last post by:
Hi all I am using Crystal report and I am running my report successfully for my query but I want to make my query for one specific date. I want to get the date value from the textbox value. ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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...
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...
0
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,...

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.