Results 1 to 4 of 4
  1. #1
    dskulman is offline Novice
    Windows Vista Access 2007
    Join Date
    Mar 2011
    Posts
    4

    Records duplicated based on field

    I have a subscription database that shows the # copies someone wants sent to them.



    I want the query to create a record for EACH copy they want.

    For some reason, the people that create the mailing labels say they can't use the # copies field, that I MUST output a record for each copy instead.

    I don't know how to do this - CAN ANY BODY OUT THERE HELP ME?

    Thanks - your humble servant
    Bytesizegal

  2. #2
    orange's Avatar
    orange is online now Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,725
    How do you output records now?

    Do you use vba?
    (You must adjust with your table(s) and field names)

    You could do something like
    ...
    Dm NumCopies as Integer


    Open RS("SELECT Person, address, CopiesRequired")
    do WHILE NOT rs.eof
    numCopies = CopiesRequired
    For x = 1 to NumCopies
    Write an output records for this client
    next
    rs.MOVENEXT

    Loop

    (untested, but should give idea of approach)

  3. #3
    dskulman is offline Novice
    Windows Vista Access 2007
    Join Date
    Mar 2011
    Posts
    4

    Red face

    I am running a query:

    SELECT Subscriber_File.State, Subscriber_File.Zip, Subscriber_File.Subscriber_ID AS [Unique], Subscriber_File.ChKey, Subscriber_File.Last, Subscriber_File.First, Subscriber_File.Street, Subscriber_File.Address2, Subscriber_File.City, Subscriber_File.ExpDate, Subscriber_File.NumOfPapers, Subscriber_File.AcctRec_Code, Subscriber_File.Title
    FROM Subscriber_File
    WHERE (((Subscriber_File.ExpFlag)<>"Y") AND ((Subscriber_File.Subscriber_Type)="P")) OR (((Subscriber_File.Subscriber_Type)="B"));

    Then I have a button on the switchboard that outputs the result to an Excel file and attaches it to an email message.

    Can you tell by the SQL code in the query above how to create a module or something I can run from a macro from the switchboard to do this?

    I am not much of a coder. The above code was the SQL view of the select query.

    Thank you!

    Donna

  4. #4
    orange's Avatar
    orange is online now Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,725
    It appears that Subscriber_File.NumOfPapersn is the number of copies for the
    Subscriber_File.Subscriber_ID AS [Unique]


    I suggest you should get more familiar with your situation. You will need to understand the data you are working with.
    As for Access and some basics including vba, I recommend you watch the videos and read some of the text and examples here.

    http://www.accessmvp.com/strive4peace/

    Post back as necessary, but "working through some examples" is the best experience.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 5
    Last Post: 01-20-2011, 11:36 PM
  2. Selecting a corresponding table field based on text field.
    By michaeljohnh in forum Programming
    Replies: 5
    Last Post: 10-08-2010, 10:33 AM
  3. Replies: 2
    Last Post: 07-15-2010, 10:26 AM
  4. Find records based on a field in a form
    By rbw95662 in forum Programming
    Replies: 3
    Last Post: 06-15-2010, 04:12 PM
  5. Total based on Formula based on field value
    By cjbuechler in forum Reports
    Replies: 15
    Last Post: 07-10-2009, 09:56 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums