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

How to get the max value from query in ms access with visual basic

3
i need help in sql query for getting max value in ms access with visual basic 6.

i have a table named book_info where it has a a column name "Accession Number" that has 5 inputs in it "1,2,3,4 and 5", i've tried to get the max value on it:
Expand|Select|Wrap|Line Numbers
  1. dim a as long
  2. a = adoAdd.RecordSource = "Select MAX(Accession Number) from book_info"
  3. lblAccNo= a
  4.  
with visual basic 6 and i tried to output the result in a label but it always says "false" on the value. i need to get it to be "5"
is my syntax wrong? if it is can you reply with the correct code? Thank you
Dec 3 '10 #1
2 8393
code green
1,726 Expert 1GB
You can't have spaces in field names.
Expand|Select|Wrap|Line Numbers
  1. Select MAX(Accession Number) from book_info
Alright you can, but thay need to be wrapped in square brackets in Access
Expand|Select|Wrap|Line Numbers
  1. Select MAX([Accession Number]) from book_info
Dec 3 '10 #2
neph
3
problem solved thanks
Dec 9 '10 #3

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

Similar topics

0
by: Ray | last post by:
Date problem. Using non American date formats with Microsoft Access and Visual Basic. I set my regional settings to English(Ireland) or English(United Kingdom) and my date appears in Access as...
9
by: stuart wieder | last post by:
receiving error message "the database has been placed in a state by user .... on machine ......that prevents it from being opened or locked" i need to have multiple users being able to access the...
5
by: Eglute | last post by:
Hello I want to show the results of database query in Visual basic. Do you know how to do this? I want to show the results in objects such as label or text box. Please help me. My code is: Dim db...
1
by: Eglute | last post by:
Hello I want to show the results of MS Access database query in Visual basic. Do you know how to do this? I want to show the results in objects such as label or text box. Please help me. My code is:...
5
by: Newbie19 | last post by:
I'm trying to break up a sql query from being on long line, so it is easier to maintain for future users. currently I have this: Dim QrtTest As String QrtTest = "SELECT dbo.Issues.ID,...
1
by: vai | last post by:
hi all, i'm developing a stock management system. in this system i'm developing a billing system which on daily & monthly basis. i'm using ms-acess database as backend & visual baic as front end....
1
by: Coll | last post by:
I'm working on a database that someone else created. I have a form - frm_main that is based on a query that is based on two tables. The join is such that the first table tbl_JCN has all records...
1
by: KezerKing | last post by:
Hi there, I am just wondering if it is possible to have the input box script: InputBox(Password, Password) to have the view of what is inputted set in *'s Laters, Kieran
1
by: Hal Kaelin | last post by:
Compile Error Ambiguous name detected: OpenReferenceDocument See attached file Private Sub lstRecapFileList_DblClick(Cancel As Integer) Call OpenReferenceDocument(RecapFolder &...
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...
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
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...
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
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...

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.