A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Database Design
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Amend Table with SeqNumber



 
 
Thread Tools Display Modes
  #1  
Old May 3rd, 2007, 10:15 PM posted to microsoft.public.access.tablesdbdesign
bbcombo
external usenet poster
 
Posts: 3
Default Amend Table with SeqNumber

John Wilson I read your code on updating a form in increments of 1 however i
must be doing something incorrect as I get Run Time Errors. I have a group
of products with serial numbers already establishing a history. I am trying
to take this data set and add a sequence number to the existing one. The
data is broken down by Part Name, Part Number and its serial number. I
identified the SNStart as the last record serial number for each specific
part. I tried this code you provided on an earlier blog but am again run
errors. Can anyone provide me with the code to simply update the part number
record and its serial number by one. Next if we make 5 units make the last
record five serial numbers later. Lastly how to generate a summary report
showing the range of the amended serial number records. I have included my
current code. Thanks in advance. Private Sub Form_BeforeInsert(Cancel As
Integer)
Me![txtSNStart] = Nz(DMax("[SNStart]", "[FootSwitch1]"), 11462) + 1
End Sub
  #2  
Old May 4th, 2007, 05:23 AM posted to microsoft.public.access.tablesdbdesign
John W. Vinson
external usenet poster
 
Posts: 18,261
Default Amend Table with SeqNumber

On Thu, 3 May 2007 14:15:02 -0700, bbcombo
wrote:

John Wilson


I'm guessing you mean me - the name's Vinson, not Wilson, though.

I read your code on updating a form in increments of 1 however i
must be doing something incorrect as I get Run Time Errors. I have a group
of products with serial numbers already establishing a history. I am trying
to take this data set and add a sequence number to the existing one. The
data is broken down by Part Name, Part Number and its serial number. I
identified the SNStart as the last record serial number for each specific
part. I tried this code you provided on an earlier blog but am again run
errors. Can anyone provide me with the code to simply update the part number
record and its serial number by one. Next if we make 5 units make the last
record five serial numbers later. Lastly how to generate a summary report
showing the range of the amended serial number records. I have included my
current code. Thanks in advance. Private Sub Form_BeforeInsert(Cancel As
Integer)
Me![txtSNStart] = Nz(DMax("[SNStart]", "[FootSwitch1]"), 11462) + 1
End Sub



You don't NEED a separate SNStart field, and should not have one. DMax will
find the largest value of its argument from the table - you're duplicating
effort by calculating it.

If your serial number field is named SN, and you want to store an incremented
SN in your table, and if you have data in the table already, just use

Me!txtSN = DMax("[SN], "[nameofyourtable]") + 1

If FootSwitch1 is the name of the table use it. I though FootSwitch1 was the
name of a field in the table.


John W. Vinson [MVP]
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 04:14 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.