Hollis,Virginia
HollisVJ at pgdp.usec.com
Wed Jul 23 07:05:00 CDT 2003
I tried your suggestion and it didn't make any difference. Va. -----Original Message----- From: Gustav Brock [mailto:gustav at cactus.dk] Sent: Wednesday, July 23, 2003 6:36 AM To: Access Developers discussion and problem solving Subject: Re: [AccessD] Continue Incrementing Hi Virginia As you describe it, your form should work ... You may wish to save it though after update of the number field. The easiest way is: Me.Dirty = False /gustav > Do I just need to create a "save" command button and use that or does the > following need to be placed within the same code below we've been discussing > (within the doubleclick event of the field). " DoCmd.DoMenuItem acFormBar, > acRecordsMenu, acSaveRecord, , acMenuVer70" > If so, can you tell me where to place it? > I hope this takes care of it. I'm so frustrated and I just thought that if > the document number created through code on the form is saved when moving to > the next record (and it actually shows up in the table), that the code would > look at the table for the next record and increment by one. > -----Original Message----- > From: Gustav Brock [mailto:gustav at cactus.dk] > Sent: Wednesday, July 23, 2003 4:48 AM > To: Access Developers discussion and problem solving > Subject: Re: [AccessD] Continue Incrementing > Hi Virginia > I think so (not quite sure how your form is working). > /gustav >> Do you mean it has to save the record first? Even if it is adding the >> document number to the table? >> -----Original Message----- >> From: Hollis,Virginia [mailto:HollisVJ at pgdp.usec.com] >> Sent: Tuesday, July 22, 2003 1:09 PM >> To: 'Access Developers discussion and problem solving' >> Subject: RE: [AccessD] Continue Incrementing >> Well, the document number (i.e. BOM-2601-0010) populates the appropriate >> field in the table. I thought that the coding would look at the table >> field >> and see that there is this document number already there and increment by >> one. >> Va. >> -----Original Message----- >> From: Gustav Brock [mailto:gustav at cactus.dk] >> Sent: Tuesday, July 22, 2003 11:39 AM >> To: Access Developers discussion and problem solving >> Subject: Re: [AccessD] Continue Incrementing >> Hi Virginia >> It looks like you don't save the new document number .... >> /gustav >>> When I open my form and add a new record and (say there is already a >>> record >>> in the table "BOM-2601-0010"), the next number given is correct >>> ("BOM-2601-0011"). >>> However, if I add another record and use the same prefixes as before >>> "BOM-2601"......the next number given is the same as the previous >>> ("BOM-2601-0011"). For some reason, I can only get it to increment one >>> time only and that's all. >>> Is there something I can insert in the following statement (which is a >>> doubleclick event that assigns the Document Number), which tells it to >>> continue incrementing even though the prefixes are the same? >>> ****************************** >>> Private Sub DocumentNumber_DblClick(Cancel As Integer) >>> Dim intMax As Integer, strPrefix As String >>> If Me.DocumentNumber = "" Or IsNull(Me.DocumentNumber) Then >>> strPrefix = Me.[cboDocType].Column(0) & "-" & Me.cboWBSCodesSelect & "-" >>> If DCount("DocumentNumber", "DocumentList", "Mid([DocumentNumber],6,4)='" >>> & Me.cboWBSCodesSelect & "'") > 0 Then >>> intMax = DMax("Val(Mid([DocumentNumber],11))", "DocumentList", >>> "Mid([DocumentNumber],6,4)='" & Me.cboWBSCodesSelect & "'") >>> Me.DocumentNumber = strPrefix & Format(intMax + 1, "0000") >>> Else >>> Me.DocumentNumber = strPrefix & "0001" >>> End If >>> End If >>> End Sub _______________________________________________ AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com