467,859 Members | 1,383 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,859 developers. It's quick & easy.

Finding the Biggest Number

Ali Rizwan
512MB
Hi,
I want to find the biggest number from a database using ADODC

Suppose.
Database has records in arrangement 1,2,5,7,8,20,99,3,4
and i want the biggest number from this field which is 99.
How can i do this.
plz help me
Using VB6 and Access
Thanx
Oct 1 '07 #1
  • viewed: 3136
Share:
8 Replies
Expert 8TB
Two main options come to mind...
  1. Use the SQL Max() function on the field.
  2. Read all the records, and look for the biggest number yourself.
Oct 1 '07 #2
QVeen72
Expert 1GB
Hi,

use this query :

Select Max(MyFieldName) From MyTableName

REgards
Veena
Oct 1 '07 #3
Ali Rizwan
512MB
Hi,

use this query :

Select Max(MyFieldName) From MyTableName

REgards
Veena
Thanx for the reply
But sorry i dont know how to make expression for sql
Plz help me
Thanx
Oct 1 '07 #4
QVeen72
Expert 1GB
Hi,

Open a Recordset with that SQL Query..

REgards
Veena
Oct 1 '07 #5
hariharanmca
1GB
Thanx for the reply
But sorry i dont know how to make expression for sql
Plz help me
Thanx
Which connection you are using?
ADODB Or ADODC?
Oct 1 '07 #6
Ali Rizwan
512MB
Which connection you are using?
ADODB Or ADODC?
Thanx
I m using ADODC? and dont know about sql quries.
Two more questions if you dont mind.
How can i calculte the number of Ps Ts or Ls ?
How can i find the biggest number ?

Thanx
Thanx a lot
Oct 1 '07 #7
hariharanmca
1GB
I think the below example will helps you.
Expand|Select|Wrap|Line Numbers
  1.     Adodc1.CommandType = adCmdUnknown
  2.     Adodc1.RecordSource = "Select Max(MyFieldName) From MyTableName"
  3.     Adodc1.Refresh
  4.     Adodc1.Recordset.MoveFirst
  5.     MsgBox " Max Value : " & Adodc1.Recordset.Fields(0)
  6.  
Oct 1 '07 #8
Ali Rizwan
512MB
I think the below example will helps you.
Expand|Select|Wrap|Line Numbers
  1.     Adodc1.CommandType = adCmdUnknown
  2.     Adodc1.RecordSource = "Select Max(MyFieldName) From MyTableName"
  3.     Adodc1.Refresh
  4.     Adodc1.Recordset.MoveFirst
  5.     MsgBox " Max Value : " & Adodc1.Recordset.Fields(0)
  6.  
Thanks a lot Hari.
Thanks for this simple example Thanks a lot.
Oct 1 '07 #9

Post your reply

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

Similar topics

32 posts views Thread by someone else | last post: by
4 posts views Thread by sathyashrayan | last post: by
30 posts views Thread by vim | last post: by
29 posts views Thread by fdmfdmfdm | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.