ACCESS FORM - saving a variable field value

G

Guest

My question is how do I save a value in a table that is current blank to a
new value. I have a form for a pruchasing table which I want to add a new
record to based on supplier inspection results. I have a unique record number
which I want to increment by 1 and save as a new record number. The field
name is SWS Record No and the expression I currently have on the form is -->
=IIf(IsNull([SWS Record No]),("SWS"+CStr(100000+(1+Max([ID])))),[SWS Record
No]) where ID is a field of numbers in the table. When I do a new record
button ("*>") I display the new SWS Record No I want but I do not know how to
save this back into the table as a new record number. I also want to save the
month number and year in their respective fields based on calculating them
from an inputted date to the form. I appreciate any help and direction you
can provide. Thank You ahead of time...........
 
A

Al Camp

FShott,
Probably, you have your SWSNo calculation in the ControlSource of the
field. It should be in the Default property.
Your ControlSource should be the SWSRecordNo field from your table.
When you go to a new record, the Default value calculation will enter the
results into the field it is bound to... SWSRecordNo.

Re the Month and Year...
Since I assume you are capturing the "inputted date" you referred to,
there would be no need to ever capture/save the Month of that date and the
Year of that date. It can always be displayed at any time. An Unbound text
control with...
= Month(YourDateField)
would always display the correct Month, and the same for the a Year
calculated field.
Don't save a calculation value to a table that can always be derived (in
any subsequent form, query, or report) from the data you already have
captured.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top