Save Text in Field

G

George

I have a form that loads the data directly into a single table. After I
scroll thru all the fields the data moves to the table, that works as
planned. What I am trying to figure out is a short-cut to save re-entering
data in the fields that doesn't change.
What I have is several records for each person each day and the first five
fields are the same for each record, ie. Name, SS#, Home Address. Is there a
way to freeze the data in those fields until I close and reopen the form.
 
J

Jeff Boyce

George

If your table has the same values ("Name", "SS#", "Home Address", ...)
repeating in multiple rows, you have ... a spreadsheet!

Access is a relational database, not a "spreadsheet on steroids". While
you'd have to "re-enter data in the fields that don't change" if you were
working in a spreadsheet, doing that in Access is a pretty good sign that
your data is not well-normalized.

Who cares, you ask? You do! If you want to get the best out of Access
relationally-oriented features and functions, you can't feed it 'sheet data.

I'd suggest that you step back from "how" you are trying to do something and
revisit "normalization" and "relational database design" as topics, review
and possibly revise your table structure, then start working on the "how".

By the way, Access treats the word "Name" as a reserved word, and may not
interpret it to mean what you think it means.

Note#2: using a space in a field name (e.g., "Home Address") can confuse
Access if you don't use delimiters ... easier to change that to HomeAddress.

Note#3: If you have one set of data about a person, then multiple additional
information related to that person, you probably have a "one-to-many"
relationship, handled with TWO tables in Access, and usually with a main
form plus subform for data entry.

Good luck!

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
L

Linq Adams via AccessMonster.com

First off, every thing Jeff has said here is valid. I suspect that your
database is far from normalized, and you probably do need to step back and
look at things
as he suggested.

Having said that, there are times when a field or fields are repeated, quite
properly, from one record to the next. Here's a short tutorial on how to do
this:

In your form, you can use the AfterUpdate event of the control holding your
data to set the DefaultValue for the field. From that time forward, until you
either manually change the data or close your form, the data will be entered
automatically in each new record. The syntax varies slightly, depending on
the datatype of the data:

For Date fields

Private Sub YourDateControlName_AfterUpdate()
If Not IsNull(Me.YourDateControlName.Value) Then
YourDateControlName.DefaultValue ="#" & Me.YourDateControlName & "#"
End If
End Sub

For Text fields

Private Sub YourTextControlName_AfterUpdate()
If Not IsNull(Me.YourTextControlName.Value) Then
YourTextControlName.DefaultValue = """" & Me.YourTextControlName.Value &
""""
End If
End Sub

For Numeric fields

Private Sub YourNumericControlName_AfterUpdate()
If Not IsNull(Me.YourNumericControlName.Value) Then
YourNumericControlName.DefaultValue = Me.YourNumericControlName.Value
End If
End Sub
 
G

George

Thank you for your time - I will try the afterupdate.

The other stuff I will learn over time.
 
G

George

Pure Genius !

I tried your code on all the fields I want to hold
the text into the next record and it works.

Thank You
 

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