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 / May 2008

Tip: Looking for answers? Try searching our database.

Subform numbering error

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Bobbye R - 23 May 2008 03:47 GMT
I have a job form with a subform that numbers the reports submitted for each
job.  I set my default for reportNumber as follows:
=DMax("[ReportNumber]+1 ","tblPWreportLog","[jobnumber] =  
Forms!frmJobs![JOBNO]  ")
When I initially open my form the first job looks something like this:
reportnumber  date  title
1                03/5/08    3
2                03/20/08  3
#Error
If I move to another record and come back to the first record the error has
changed to a 3 which is what I want.  I just don't know how to make the 3
appear when I open the form.

The second thing that happens is when I add a new job on the main form.  I
don't know how to force the first report number to equal 1 (which I thought
was my default) I get #Error.
Signature

Access 2000 User,  Thanks in advance  Bobbye

Graham Mandeno - 23 May 2008 04:23 GMT
Hi Bobbye

I suspect the first problem is being caused by a timing glitch.  I think the
subform is opening before [JOBNO] on the main form has a value.

The second problem is for the same reason: for a new record, [JOBNO] is
null.

So in both cases your criteria string simply says "[jobnumber]=", which is
invalid.

Try using this expression instead:
   =Nz(DMax("[ReportNumber]","tblPWreportLog",
       "[jobnumber]=Nz(Forms!frmJobs![JOBNO],0)"), 0) + 1

Signature

Good Luck  :-)

Graham Mandeno [Access MVP]
Auckland, New Zealand

>I have a job form with a subform that numbers the reports submitted for
>each
[quoted text clipped - 15 lines]
> thought
> was my default) I get #Error.
Bobbye R - 23 May 2008 04:58 GMT
Hi Graham,
I entered the expression you wrote (I'm afraid I don't understand nz or what
the zero stand for but I'll look it up tomorrow)
I still get an error when I initially open the form.  (I'll keep trying
there too.)  
When I enter a new job on the main form the reportnumber on the subform =
#Error and when I input info on the  subform the reportnumber changes from
#Error to 0 instead of 1.  Any other suggestions?
Signature

Access 2000 User,  Thanks in advance  Bobbye

> Hi Bobbye
>
[quoted text clipped - 30 lines]
> > thought
> > was my default) I get #Error.
Jan Baird - 27 May 2008 20:51 GMT
Jan Baird is out of the country until September 20.   Every effort will be
made to respond to messages, but please be patient.
Jan Baird - 27 May 2008 20:51 GMT
Jan Baird is out of the country until September 20.   Every effort will be
made to respond to messages, but please be patient.
 
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.