473,802 Members | 1,960 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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("Revisi onID", "tbl_revisi on", "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 2272
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("Revisi onID", "tbl_revisi on", "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("Revisi onID", "tbl_revisi on", _
"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("Revisi onID", "tbl_revisi on", _
"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:::mgf0 0 <at> earthlink <decimal-point> net
Oakland, CA (USA)

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

iQA/AwUBQiSu+4echKq OuFEgEQLALwCfT0 bYppGY0SSwAs4vn EkypK1RU8cAoOtS
7iiyCd6FedWFMaY wDaPEUqTg
=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*********@ya hoo.co.uk> wrote in message
news:11******** **************@ g14g2000cwa.goo glegroups.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("Revisi onID", "tbl_revisi on", "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
1303
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 different results when I query this field under XP and 2000. Under XP I get the correct data...True or False. However, under 2000...the same app/query returns True when the dBase field value is 0. Has anyone else experienced this? Does anyone...
3
3533
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. However, the DAILYID increments automatically to "10" just fine, but does not go beyond "10" until the date changes. I have the following code in my form's CURRENT event: Private Sub Form_Current()
3
23882
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 converted the mdb to version 2002 under MS Access XP Polish and under this version everything works OK. The problem starts when I copy the mdb file to Windows XP EN and start it with MS Access XP EN. I get following error: "The expression On...
12
6394
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 ranges, ie between 24/09/2004 and 01/10/2004 together with 05/10/2004 and 07/10/2004 ? If I enter the "Between" criteria on different lines it returns no data.
4
3541
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 objective in utilizing this new deployment method is to reduce the maintenance overhead as well as making it easier for my users to setup and run the application initially. I have VS 2002, Windows XP, Access XP(2000 format). He is my problem....
0
3062
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 objective in utilizing this new deployment method is to reduce the maintenance overhead as well as making it easier for my users to setup and run the application initially. I have VS 2002, Windows XP, Access XP(2000 format). He is my problem....
17
4423
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 there, but is there a way they can find out if that application was put there from a CD or email or created at work? Hint: It's not on a client/server database, just native jet database mdb created on Access 2003 (default 2000)...
10
12721
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 certain that MyVar will be set to the key-field value that was created when the Append query ran. Now, there are other ways to do it - I know - that will ensure you 'nab' the correct record. But I was wondering
3
2091
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 applicants applying for assistance (with a specific date and time). I have created an applicant table and form, PK is an autonumber, CaseNbr is long integer, applicant name/address etc.
0
9699
marktang
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9562
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10309
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10289
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9119
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7600
isladogs
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5496
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5625
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3795
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.