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

Using DMAX field in Access Project (XP) connected to SQL 2000

Hi All,

I have come across some rather weird error that I can only assume is
something to do with my ADP file connecting to SQL Server 2000.
I'm using Access XP as my front end.

In simple terms:
I have a database which is in design for a new Development Request
system. The main 2 tables are linked one to many, by in this instance
say DWR_ID.
The main input screen is a tabbed form with a subform on the second
tab. The subform looks at tbl_Revisions, whilst the main form overlays
tbl_DWR. DWR_ID is shown on the form on the first tab, but is hidden
on the subform.
A field called RevisionID in tbl_Revisions, which is the main part of
the subform, needs to increment by 1.
A revision of 1 will exist for every single DWR that exists in the
database, so RevisionID is set to Duplicates OK. When a new revision
is created, I have a button that "On-Click" event - and when clicked
should look at the DWR_ID, look up any RevisionID's for that DWR_ID,
take the highest value and increment by 1.

The code for doing this in VBA is;
me.RevisionID = nz(DMAX("RevisionID", "tbl_revision", "DWR_ID= " &
Me.[DWR_ID]), 0) + 1

The above code works if I create a MDB file in the same way, but when
using my ADP file connected to the SQL Server, when the button is
pressed I get an error of;

Invalid Syntax near ')'.

Everywhere I've looked has suggested that the problem exists within the
code for the Criteria part of the DMAX command.

Has anybody got any ideas on this, I'm pretty good when it comes to
Access, but now I've got to the stage of trying to use SQL as the
back-end, I'm coming across more and more things I haven't got a clue
about!!

Help is much appriciated,

Luke Argent
IT Technical Support.

##no bits or bytes were harmed during the filming of this programme##

Nov 13 '05 #1
4 2249
lukeargent wrote:
Hi All,

I have come across some rather weird error that I can only assume is
something to do with my ADP file connecting to SQL Server 2000.
I'm using Access XP as my front end.

In simple terms:
I have a database which is in design for a new Development Request
system. The main 2 tables are linked one to many, by in this instance
say DWR_ID.
The main input screen is a tabbed form with a subform on the second
tab. The subform looks at tbl_Revisions, whilst the main form overlays
tbl_DWR. DWR_ID is shown on the form on the first tab, but is hidden
on the subform.
A field called RevisionID in tbl_Revisions, which is the main part of
the subform, needs to increment by 1.
A revision of 1 will exist for every single DWR that exists in the
database, so RevisionID is set to Duplicates OK. When a new revision
is created, I have a button that "On-Click" event - and when clicked
should look at the DWR_ID, look up any RevisionID's for that DWR_ID,
take the highest value and increment by 1.

The code for doing this in VBA is;
me.RevisionID = nz(DMAX("RevisionID", "tbl_revision", "DWR_ID= " &
Me.[DWR_ID]), 0) + 1

The above code works if I create a MDB file in the same way, but when
using my ADP file connected to the SQL Server, when the button is
pressed I get an error of;

Invalid Syntax near ')'.

Everywhere I've looked has suggested that the problem exists within the
code for the Criteria part of the DMAX command.

Has anybody got any ideas on this, I'm pretty good when it comes to
Access, but now I've got to the stage of trying to use SQL as the
back-end, I'm coming across more and more things I haven't got a clue
about!!


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Is the DWR_ID a string? If so, you have to delimit it with quotes (in
this case single-quotes):

nz(DMAX("RevisionID", "tbl_revision", _
"DWR_ID='" & Me.[DWR_ID] & "'"), 0) + 1

It may also be the reference to the Control "DWR_ID" (I'm assuming that
Me.DWR_ID is a reference to a control?). Perhaps if you put the value
of the control in a variable.

strDWRID = Me!DWR_ID
nz(DMAX("RevisionID", "tbl_revision", _
"DWR_ID='" & strDWRID & "'"), 0) + 1

Or, if you used the bang (!) indicator instead of the period indicator:

Me!DWR_ID instead of Me.DWR_ID.

If all else fails, try using a stored procedure.

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQiSu+4echKqOuFEgEQLALwCfT0bYppGY0SSwAs4vnEkypK 1RU8cAoOtS
7iiyCd6FedWFMaYwDaPEUqTg
=Od7g
-----END PGP SIGNATURE-----
Nov 13 '05 #2
Luke,

In my adp, I have found that is is faster to run a Stored procedure to get
data rather than using the DMax/Min/etc functions.

Just a suggestion.
J. Clay

"lukeargent" <lu*********@yahoo.co.uk> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com...
Hi All,

I have come across some rather weird error that I can only assume is
something to do with my ADP file connecting to SQL Server 2000.
I'm using Access XP as my front end.

In simple terms:
I have a database which is in design for a new Development Request
system. The main 2 tables are linked one to many, by in this instance
say DWR_ID.
The main input screen is a tabbed form with a subform on the second
tab. The subform looks at tbl_Revisions, whilst the main form overlays
tbl_DWR. DWR_ID is shown on the form on the first tab, but is hidden
on the subform.
A field called RevisionID in tbl_Revisions, which is the main part of
the subform, needs to increment by 1.
A revision of 1 will exist for every single DWR that exists in the
database, so RevisionID is set to Duplicates OK. When a new revision
is created, I have a button that "On-Click" event - and when clicked
should look at the DWR_ID, look up any RevisionID's for that DWR_ID,
take the highest value and increment by 1.

The code for doing this in VBA is;
me.RevisionID = nz(DMAX("RevisionID", "tbl_revision", "DWR_ID= " &
Me.[DWR_ID]), 0) + 1

The above code works if I create a MDB file in the same way, but when
using my ADP file connected to the SQL Server, when the button is
pressed I get an error of;

Invalid Syntax near ')'.

Everywhere I've looked has suggested that the problem exists within the
code for the Criteria part of the DMAX command.

Has anybody got any ideas on this, I'm pretty good when it comes to
Access, but now I've got to the stage of trying to use SQL as the
back-end, I'm coming across more and more things I haven't got a clue
about!!

Help is much appriciated,

Luke Argent
IT Technical Support.

##no bits or bytes were harmed during the filming of this programme##



----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
Nov 13 '05 #3
Thanks for the help, I have tried all of your suggestions but I still
keep getting the same error message back.

I even tried them in my test MDB file and they worked in there so I
know it wasn't a case of syntax as they are exactly the same in my MDB
and ADP files.

I'm going to look into a stored procedure, I haven't used one yet so
I'm going to try that this morning.

Cheers
Luke

Nov 13 '05 #4
lukeargent wrote:
Thanks for the help, I have tried all of your suggestions but I still
keep getting the same error message back.

I even tried them in my test MDB file and they worked in there so I
know it wasn't a case of syntax as they are exactly the same in my MDB
and ADP files.

I'm going to look into a stored procedure, I haven't used one yet so
I'm going to try that this morning.

Cheers
Luke

Have you tried a select Top 1 ordered by?

Ron

--
Ronald W. Roberts
Roberts Communication
rw*@robcom.com

Nov 13 '05 #5

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

Similar topics

0
by: Randy | last post by:
Hello, I've got a c# app that connects to a dBase database via OLEDB. In one of the tables there is a Yes/No field. Under the same MDAC (2.71, I'm not sure if it has anything to do with it), I get...
3
by: Scott | last post by:
I have a database with an input form. The field "DailyID" on the form is to increment automatically with each new entry, then reset itself back to "1" at midnight and/or the change of date. ...
3
by: Stan | last post by:
Hallo, I have developed an application in MS Access 2000 (Polish version) under MS Windows XP prof (also Polish). Now I would like to run this code on MS Windows XP EN and MS Access XP EN. I have...
12
by: Steve Elliott | last post by:
I have a query set up to gather together data between two specified dates. Shown in the query column as: Between #24/09/2004# And #01/10/2004# Is it possible to enter several different date...
4
by: James | last post by:
I have a VB windows forms application that accesses a Microsoft Access database that has been secured using user-level security. The application is being deployed using No-Touch deployment. The...
0
by: James | last post by:
I have a VB windows forms application that accesses a Microsoft Access database that has been secured using user-level security. The application is being deployed using No-Touch deployment. The...
17
by: Mell via AccessMonster.com | last post by:
Is there a way to find out where an application was created from? i.e. - work or home i.e. - if application sits on a (work) server/network, the IT people know the application is sitting...
10
by: MLH | last post by:
Suppose, in a multi-user environment, you have append query SQL in a VBA procedure that looks like INSERT INTO MyTable... and the next line reads MyVar=DMax("","MyTable... You can never be...
3
by: emalcolm_FLA | last post by:
Hello and Thanks in advance for any help. I have been tasked with rewriting a christmas assistance database using Access 2003. The old system used pre-assigned case numbers to identify...
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
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
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.