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

select statement not working

Hi all,
I am using access and in that I link
the tables from oracle. I create
a form and in that i have a text field e.g. emp_no
this emp_no field should take the max value from
table emp while adding the record.
i use in one of the event functions

DoCmd.RunSql "select max(emp_no) from emp"

but its not working.
what i want is to take the result of this querry
in a variable and display it in this text field.

how to achieve this.
in this program i am not opening any database
the tables are linked from oracle.
please help.
thanks
lee.
--
Posted via Mailgate.ORG Server - http://www.Mailgate.ORG
Nov 12 '05 #1
2 2733
Yang,

you can not do that. You may either use a recordset or a function. The
function is easier but slower, it will be:

varMaxEmpNo = Dmax("emp_no";"emp")

Regards,

Valentín
**********************************************
"Yang Lee" <ya*******@ausi.com> escribió en el mensaje
news:33************************************@mygate .mailgate.org...
Hi all,
I am using access and in that I link
the tables from oracle. I create
a form and in that i have a text field e.g. emp_no
this emp_no field should take the max value from
table emp while adding the record.
i use in one of the event functions

DoCmd.RunSql "select max(emp_no) from emp"

but its not working.
what i want is to take the result of this querry
in a variable and display it in this text field.

how to achieve this.
in this program i am not opening any database
the tables are linked from oracle.
please help.
thanks
lee.
--
Posted via Mailgate.ORG Server - http://www.Mailgate.ORG

Nov 12 '05 #2
Yang Lee wrote:
DoCmd.RunSql "select max(emp_no) from emp"
RunSQL is great for append/update/delete/maketable queries, not so hot
for Select queries.

Dim rst As Recordset
set rst = Currentdb.openrecordset("select max(emp_no) As MaxNum from
emp",dbopensnapshot)
msgbox "Max Number is " & rst!MaxNum
rst.close
set rst = Nothing



but its not working.
what i want is to take the result of this querry
in a variable and display it in this text field.

how to achieve this.
in this program i am not opening any database
the tables are linked from oracle.
please help.
thanks
lee.

--
Posted via Mailgate.ORG Server - http://www.Mailgate.ORG


Nov 12 '05 #3

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

Similar topics

0
by: Hans Maurer | last post by:
>Description: We're running our current TTS application with MySQL (on Unix). All database, table and column names are in lower-case. However, we need to access this database with a new...
5
by: malcolm | last post by:
Example, suppose you have these 2 tables (NOTE: My example is totally different, but I'm simply trying to setup the a simpler version, so excuse the bad design; not the point here) CarsSold {...
17
by: kalamos | last post by:
This statement fails update ded_temp a set a.balance = (select sum(b.ln_amt) from ded_temp b where a.cust_no = b.cust_no and a.ded_type_cd = b.ded_type_cd and a.chk_no = b.chk_no group by...
3
by: dumbledad | last post by:
Hi All, I'm confused by how to replace a SELECT statement in a SQL statement with a specific value. The table I'm working on is a list of words (a column called "word") with an index int...
3
by: Tcs | last post by:
My backend is DB2 on our AS/400. While I do HAVE DB2 PE for my PC, I haven't loaded it yet. I'm still using MS Access. And no, I don't believe this is an Access question. (But who knows? I...
1
by: Eddie | last post by:
I have a DataTable.Select() statement with a DateTime field that is being compared to a Date: Dim drCal as DataRow() = tblCal.Select("CalendarItemDate ='12/1/2003'", "CalendarItemDate",...
3
by: mark.irwin | last post by:
Hello all, Have an issue where a redirect pushes data to a page with a select case which then redirects to another page. Problem is the redirect isnt working in 1 case. Code below: strURL =...
5
by: RioRanchoMan | last post by:
I have a forum table where the field Forum_ID of the first thread corresponds to itself in the field Forum_Ancestor, and 0 (zero) for the field Forum_Parent when it is the first topic in a thread:...
6
by: dbuchanan | last post by:
There are three parts to this 1.) How do I cascade menus? 2.) And, how do I cascade menus with a multi-select CheckBoxList?
2
by: kxyz | last post by:
Hello everyone, I need help with a stored procedure or two. My stored procedures are supposed to check if a certain record exists. If it does exist, then I select everything from that row, as...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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:
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
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
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...

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.