auto populate record field

AOGFADUGBA

Board Regular
Joined
Sep 30, 2015
Messages
74
Hi.
how can i increase a number field by one in the next record on a form?
i don't want to use the auto-number data type.
Thanks
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
You could mean you want to increase every existing value that you already have in a number field by 1. That is one thing.
I think you want the next number that is one higher than the highest one you already have in that field. That is another thing.
If they are going to be successive anyway, what's wrong with using an autonumber since it already does what you are trying to do? What you're suggesting is no more reliable and could cause data integrity issues if the last record is deleted. The next record will have the same highest number that you had before, but there might be records related to the old record with that same number.

Then there is the issue of when are you going to create this number? If you need it at the beginning of a process because of form/subform relationships, you will have a Pandora's box that you don't want to open, especially in a db with concurrent users. Nasty things can happen, especially if someone starts then cancels a process while someone else completes it. At the very least, your number sequence will no longer be sequential, and if this is your objection to the autonumber type, you need more understanding of what exactly these are for.

If I've missed the mark and you still want to do this, the answer might be a simple function or maybe an Append query that has a calculated field.
 
Last edited:
Upvote 0
Thanks a lot for you detailed response.
what if i use the Dmax function
Private Sub Form_Current()
If Me.NewRecord = True Then
Me.number = Nz(DMax("number", "receive"), 1) + 1
End If


End Sub
 
Upvote 0
You could. Your first record in a new table will always start with 2, I suppose. Unless you replace the ,1 with ,0. I also think this would be better/safer than DCount.
Sorry - I missed the part where you said you wanted to do this in a form. I was somewhat focused on the autonumber thing.
 
Upvote 0
Hi Again,
am trying to distribute an amount int several field an a form at once. is there a way to go about it.
This is the senerio. i have a form bound to a table with 55 fields all currency/number fields and i want to create a unbound text box to input the lumpsum amount into and it will distribute it based on percentage into the 55 fields on the form. is it possible?
thanks
 
Upvote 0
Hi Again,
am trying to distribute an amount int several field an a form at once. is there a way to go about it.
This is the senerio. i have a form bound to a table with 55 fields all currency/number fields and i want to create a unbound text box to input the lumpsum amount into and it will distribute it based on percentage into the 55 fields on the form. is it possible?
thanks

Can you please show some diagrams of your form?
 
Upvote 0
You should create a new topic for this new issue.
 
Upvote 0

Forum statistics

Threads
1,221,841
Messages
6,162,314
Members
451,759
Latest member
damav78

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top