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 » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Taking data from one record, adding to previous record? Help!



 
 
Thread Tools Display Modes
  #1  
Old October 16th, 2004, 09:19 PM
Forrest Gump Ky
external usenet poster
 
Posts: n/a
Default Taking data from one record, adding to previous record? Help!

Back in the ancient days of dbase, this was simple, but now I'm stumped.

I'm an amateur programmer. I'm using a table of mailing data. When there
are two people at the same address, I want to put both names in a single name
record (such as Bill Jones and Sally Smith, instead of two records).

In dbase I would have just modified command, taken the street address, stuck
it in a memory variable, skipped to the next record, compared it to THAT
street address. For matches, I would then stick the name in the second
record in a variable, delete that second record, skip back one record and
replace name with Name plus " " plus &Memoryvariablecontents.

I've done some work with queries in Access and reports, but none with
modules or macros, so I will need someone to spell out the basics on this.

I'm sure this is something very easy, but does anyone have the solution, or
would someone please direct me to a subject that deals with it?

Thanks


  #2  
Old October 16th, 2004, 11:59 PM
Dirk Goldgar
external usenet poster
 
Posts: n/a
Default

"Forrest Gump Ky" Forrest Gump wrote in
message
Back in the ancient days of dbase, this was simple, but now I'm
stumped.

I'm an amateur programmer. I'm using a table of mailing data. When
there are two people at the same address, I want to put both names in
a single name record (such as Bill Jones and Sally Smith, instead of
two records).

In dbase I would have just modified command, taken the street
address, stuck it in a memory variable, skipped to the next record,
compared it to THAT street address. For matches, I would then stick
the name in the second record in a variable, delete that second
record, skip back one record and replace name with Name plus " " plus
&Memoryvariablecontents.

I've done some work with queries in Access and reports, but none with
modules or macros, so I will need someone to spell out the basics on
this.

I'm sure this is something very easy, but does anyone have the
solution, or would someone please direct me to a subject that deals
with it?

Thanks


You *can* follow pretty much the same procedure with Access, if you
want, using a recordset that is opened on a query that sorts the table
on the address in such a way that you can compare each record with the
previous. I can probably help you come up with code for that, if you
give me more information and if you still want me to after reading the
rest of this message.

I'd suggest, though, that if you want to record the fact that multiple
people live at the same address, it would be better to have two related
tables -- one table of addresses (with an AddressID key field) and one
table of people -- one record per person -- with the AddressID of each
person's address stored in the person's record. (That's assuming that
you don't have to cope with one person having multiple addresses -- then
you'd need three tables: Addresses, People, and PeopleAddresses to link
them.)

If you have addresses and people stored in different tables, then you
can readily determine at any time just who-all lives at any given
address, and mailings can be based on the table of addresses so as to
ensure that only one mailing is sent to any given address. Or, if you
produce your mailings as an Access report, you can easily base the
report on a join of Addresses and People (on AddressID) and group the
report by address, printing out something like.

Bill Jones
Sally Smith
123 Main St.
Somewhere, IN 99999
USA

If you want to get a line like "Bill Jones and Sally Smith", though, you
need code to concatenate the values from multiple People records.

The forms and queries to handle people and addresses in related tables
this way are admittedly more complicated than the simple,
one-record-with-multiple-people-in-the-name structure you described, but
the scheme has the advantage of accurately representing the relationship
between people and addresses, and facilitates manipulate and querying by
SQL. For example, it enables you to say things like "Give me a list of
all the people who live in zip code 12345 and whose names start with
'J'".

It really all depends on the tradeoff you choose to make between
"simple" and "powerful".

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)


 




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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Add data to an existing record Raj Running & Setting Up Queries 3 September 18th, 2004 02:02 AM
Is this possible with Excel Chart? q582gmzhi Charts and Charting 1 September 8th, 2004 03:33 AM
auto new record on enter or data entry Laura Q Using Forms 0 July 27th, 2004 05:53 PM
Avoid Creating A Duplicate Record Mark New Users 4 May 11th, 2004 01:52 AM


All times are GMT +1. The time now is 06:32 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.