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

sql query gives blank result

232 100+
Expand|Select|Wrap|Line Numbers
  1. VHANDICAP = rs("HANDICAP")
  2. strSQL = "SELECT MAX(AMOUNT) FROM TABLE WHERE VHANDI= " & VHANDICAP & "'"
  3. Debug.Print strSQL
  4. rs.Open strSQL, CurrentProject.Connection, adOpenKeyset, adLockOptimistic
sql query gives blank result for those employees who are not handicap
kindly help me to correct the error
Sep 9 '13 #1
7 1499
zmbd
5,501 Expert Mod 4TB
Line 3 gives a debug print.
Please run your code,
Presss <ctrl><g> to open the immediates window.
Copy the resolved string from that window to a post here, please format that information using the [CODE/] button.
(I suspect you're missing a quote mark)
Also any errors you are receiving.
Sep 9 '13 #2
Rabbit
12,516 Expert Mod 8TB
You have a closing single quote for your handicap value, but you don't have an opening single quote.
Sep 9 '13 #3
kkshansid
232 100+
sorry the query is
Expand|Select|Wrap|Line Numbers
  1. strSQL = "SELECT MAX(AMOUNT) FROM TABLE WHERE VHANDI= '" & VHANDICAP & "'"
it dont give error but provide blank result null value got from recordset is not null in query
Sep 10 '13 #4
Rabbit
12,516 Expert Mod 8TB
Then you'll need to follow zmbd's instructions to find the query that is running
Sep 10 '13 #5
kkshansid
232 100+
Expand|Select|Wrap|Line Numbers
  1. Select max(amount) 
  2. from table 
  3. where vhandicap=''
Expand|Select|Wrap|Line Numbers
  1. select * 
  2. from table 
  3. where vhandicap=''
both query gives blank record
Sep 10 '13 #6
jimatqsi
1,271 Expert 1GB
kkshansid, have you tried pasting this sql string into the query editor in SQL view and running tests from there? You could easily modify your query and check results instantly. After you know what query gives the result you want then you could work on assembling that query in code.

I'm wondering if the data is as you think it is. This simple test may open your eyes to something.

Jim
Sep 10 '13 #7
jimatqsi
1,271 Expert 1GB
As an aside, what is line 1 of the code in your first post about? It appears from that snippet of code that you are getting a value from a recordset that is not yet open.

Jim
Sep 10 '13 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Willem Berendsen | last post by:
Hello, I setting up my mysql-server and php on IIS6 and it works almost fine. But I got the next error: Warning: mysql_numrows(): supplied argument is not a valid MySQL result resource in...
2
by: swhite76 | last post by:
I have a section of code that adds some double values and gives an incorrect result. This occurs with data that isn't really waht I would call high precision. An example is the following code...
4
by: John Baker | last post by:
Hi: Most of the time when I do a query and it has no matches, there is a single blank line in the result that I can test. I have one query where no result produces a response with NO lines at...
2
by: ReidarT | last post by:
I use this code to print a textfile, but it gives me a lot of blank pages. The file contains 9 lines of text. Private strFileName As String = "C:\Sendepost\LoggFil.txt" Private objStreamToPrint...
2
by: gngui | last post by:
i have a query that subtracts the date of birth (dob) from the date, i.e. age_d: Date()- This is OK as it gives me the difference in days e.g. 700 days. i would like the result to show me the age...
1
by: gautam89 | last post by:
Hi everyone... I'm a high school student working on an Access project for a summer internship. I needed your assistance in writing a criteria for a select query. Table1 has the following...
3
by: Gerhard | last post by:
Hi I have a combobox on a form which gets it's Row Source from a table. I then use an Append Query to save the selected data in the combobox to a file. Everything works fine. The Combobox's...
9
by: phpmagesh | last post by:
echo "<TD class=\"main\"><SELECT NAME=\"current_product_id\">"; $query = "SELECT * FROM ".TABLE_PRODUCTS_DESCRIPTION." where products_id LIKE '%' AND language_id = '" . $_SESSION . "' ORDER BY...
1
ifedi
by: ifedi | last post by:
I've a project (medical stuff based on PHP/apache) where I need to run this query: SELECT CONCAT_WS(" ", CONCAT(pregNo,':'), del_year, MONTHNAME(CONCAT('2000-',del_month,'-01')),...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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...

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.