Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / June 2007

Tip: Looking for answers? Try searching our database.

dmax issue

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
JohnE - 04 Jun 2007 19:56 GMT
I have a form that has on it a cboFileLetter(textfield), txtFileNo
(numberfield) and a button (there are other controls but not relevent for
this posting).  When the button is clicked I need to have txtFileNo fill in
with the next incremental number for the letter that has been selected in
cboFileLetter.  The code in the click event that I have so far is;

Me.txtFileNo.Value = Nz(DMax("[FileNo]", "[tbl_Clients]", "FileLetter=" &
Me.cboFileLetter), 0) + 1

This is not working and I get an error 2001 - you canceled the previous
action.  

I seek help on this dillemma.

Thanks in advance for the help.
*** John
Carl Rapson - 04 Jun 2007 20:16 GMT
>I have a form that has on it a cboFileLetter(textfield), txtFileNo
> (numberfield) and a button (there are other controls but not relevent for
[quoted text clipped - 13 lines]
> Thanks in advance for the help.
> *** John

What is the datatype of the FileLetter field in tbl_Clients? If it's text,
you'll need to put quotes around the value you're testing:

   Me.txtFileNo.Value = Nz(DMax("[FileNo]", "[tbl_Clients]", "FileLetter='"
&  Me.cboFileLetter & "'"), 0) + 1

Carl Rapson
JohnE - 04 Jun 2007 20:29 GMT
Carl, thanks for the reply.  It is text and I just realized my error.
Thanks.

> >I have a form that has on it a cboFileLetter(textfield), txtFileNo
> > (numberfield) and a button (there are other controls but not relevent for
[quoted text clipped - 21 lines]
>
> Carl Rapson
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.