I have written a query sql = "SELECT Max(No) FROM Temp" in recordset using
rs.open sql,cn,,,adcmdText. How to fetch the result of a recordet. I get wrong answer when i execute following code: - Dim i as Long
-
-
sql = ""SELECT Max(No) FROM Temp""
-
rs.open sql, cn,,,adcmdText
-
i = rs(0)
-
MsgBox(i)
Answer i get is 0 but it should come 4.
Plz tell me correct code
13 1349
I have written a query sql = "SELECT Max(No) FROM Temp" in recordset using
rs.open sql,cn,,,adcmdText. How to fetch the result of a recordet. I get wrong answer when i execute following code:
Dim i as Long
sql = ""SELECT Max(No) FROM Temp""
rs.open sql, cn,,,adcmdText
i = rs(0)
MsgBox(i)
Answer i get is 0 but it should come 4.
Plz tell me correct code
Hi, Shailaja
Try this
Select nvl(max(no),0) from temp -> if ur using oracle
try to use adcmdDynamic
Hi, Shailaja
Try this
Select nvl(max(no),0) from temp -> if ur using oracle
try to use adcmdDynamic
I
I am not using ORACLE, My Back End is Access.
I
I am not using ORACLE, My Back End is Access.
- sql = ""SELECT Max(No) FROM Temp""
-
rs.open sql, cn,,,adcmdText
-
i = rs(0)
-
MsgBox(i)
-
-
for access qry is correct,... Ok just try this
-
-
sql = ""SELECT Max(No) FROM Temp""
-
rs.open sql, cn,,,adcmdText
-
i = rs.field(0)
-
or
-
i = rs.field(0).value
-
MsgBox(i)
I
I am not using ORACLE, My Back End is Access.
Would u pls give me the tbl structure along with some data and the version of msaccess
Would u pls give me the tbl structure along with some data and the version of msaccess
Table: Temp
No Name
1 A
2 B
3 C
sql = ""SELECT Max(No) FROM Temp""
rs.open sql, cn,,,adcmdText
i = rs(0)
MsgBox(i)
for access qry is correct,... Ok just try this
sql = ""SELECT Max(No) FROM Temp""
rs.open sql, cn,,,adcmdText
i = rs.field(0)
or
i = rs.field(0).value
MsgBox(i)
I have tried both the above code , u have given. But still getting 0 answer.
Table: Temp
No Name
1 A
2 B
3 C
Shailaja there are so many problems in msaccess, ur facing one of them right now
the sol is just change the column name from no to myno or what evr u like
and run the qry
alsom change the name field name if u will use date then donot use ddate or date as column name
by
Personally, I think the problem might be the extra quotes around the SQL. To quote your original code... - Dim i as Long
-
-
sql = ""SELECT Max(No) FROM Temp""
-
rs.open sql, cn,,,adcmdText
-
i = rs(0)
-
MsgBox(i)
What about trying this... - Dim i as Long
-
-
sql = "SELECT Max(No) FROM Temp;"
-
rs.open sql, cn,,,adcmdText
-
i = rs(0)
-
MsgBox(i)
Personally, I think the problem might be the extra quotes around the SQL. To quote your original code... - Dim i as Long
-
-
sql = ""SELECT Max(No) FROM Temp""
-
rs.open sql, cn,,,adcmdText
-
i = rs(0)
-
MsgBox(i)
What about trying this... - Dim i as Long
-
-
sql = "SELECT Max(No) FROM Temp;"
-
rs.open sql, cn,,,adcmdText
-
i = rs(0)
-
MsgBox(i)
No Boss the problem will be get solved by the suggetion i'v given just try it out
bye
No Boss the problem will be get solved by the suggetion i'v given just try it out
No, pick me! :D
Seriously, though. Are you thinking fieldname "No" is being interpreted in the context of Yes/No? Have to watch those reserved words, huh.
No, pick me! :D
Seriously, though. Are you thinking fieldname "No" is being interpreted in the context of Yes/No? Have to watch those reserved words, huh.
Yes in MS Access 'No' is reserved word, just we have to try some other
No, pick me! :D
Seriously, though. Are you thinking fieldname "No" is being interpreted in the context of Yes/No? Have to watch those reserved words, huh.
Just do the thing i sugested and u will get the ans itself :D
To avoid problems with reserved words in sql it is always good practise to write your statements out in full including square brackets, no shortcuts and no fingers crossed :) - Dim i As Long
-
Dim sql As String
-
-
sql = "SELECT Max([Temp].[No]) AS MaxNo FROM [Temp]"
-
rs.open sql, cn,,,adcmdText
-
i = rs("MaxNo")
-
MsgBox("The max no is: " & i, "Maximum Number")
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Rob |
last post by:
I have a form - when you click the submit button, it appends a
variable to the URL (e.g. xyz.cgi?inputID=some_dynamic_variable)
It also opens a new page. Now, that some_dynamic_variable is...
|
by: Stefan Bauer |
last post by:
Hi NG,
we've got a very urgent problem... :(
We are importing data with the LOAD utility. The input DATE field data
is in the format DDMMYYYY (for days) and MMYYYY (for months).
The target...
|
by: Mike |
last post by:
Hello,
I have a few rather urgent questions that I hope someone can help with (I
need to figure this out prior to a meeting tomorrow.) First, a bit of
background: The company I work for is...
|
by: Tamir Khason |
last post by:
Follwing the struct:
public struct TpSomeMsgRep
{
public uint SomeId;
|
by: |
last post by:
Hi all, I have a website running on beta 2.0 on server 2003 web sp1 and I
keep getting the following error:-
Error In:...
| |
by: zeyais |
last post by:
Here is my HTML:
<style>
..leftcolumn{float:left;width:300px;border: 1px solid #ccc}
..rtcolumn{float:left;width:600px;border: 1px solid #ccc}
</style>
<body>
<div class="leftcolumn"...
|
by: dembla |
last post by:
Hey Frnds can anyone help me in this
i need a program in 'c'
PROGRAM to print NxN Matrix
9 1 8 1 2 3
2 7 3 as 4 5 6
6 4 5 7 8 9
in sorted form
|
by: ginnisharma1 |
last post by:
Hi All,
I am very new to C language and I got really big assignment in my
work.I am wondering if anyone can help me.........I need to port
compiler from unix to windows and compiler is written...
|
by: N. Spiker |
last post by:
I am attempting to receive a single TCP packet with some text ending with
carriage return and line feed characters. When the text is send and the
packet has the urgent flag set, the text read from...
|
by: Cirene |
last post by:
I used to use the Web Deployment Project with my VS2005 projects.
Now I've fully upgraded to VS2008. Do I have to download a new version of
the Web Deployment Project? If so where can I find...
|
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,...
| |
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...
|
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...
|
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...
|
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...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
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 ...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |