Results 1 to 7 of 7
  1. #1
    Jen0dorf is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Jul 2015
    Location
    UK
    Posts
    453

    Pairing records from excell

    Hi

    would apprecate some ideas as to how to pair records.

    I have been asked to create a database for marriage bans. I have the data in an excell file with the following colums

    ficheno, page no, entry number, date, year, forename,last name, condition, occupation, minister.

    Ok no problems creating and inputing the data to a table and creating a form to show the data and add a search button.

    However I have realised that in the spread sheet

    Line one and line two are "a couple" as are 3 and 4 and 5 and 6 etc etc.

    So on my form I would like the details from a pair to be shown , similalry when a search is done by surname I'd like the results to show the pair.

    Wouls appreciate some pointers

    thanks

    Ian

  2. #2
    mrmmickle1's Avatar
    mrmmickle1 is offline Advanced Beginner
    Windows 7 64bit Access 2013
    Join Date
    Sep 2014
    Location
    North Carolina
    Posts
    78
    Do any of these fields demarcate the relationship between the couples?

    ficheno, page no, entry number, date, year, forename,last name, condition, occupation, minister

    For example is ficheno or page no duplicated for these two records? ---> Letting you know that these two records are associated as 1 ceremony/marriage

  3. #3
    Jen0dorf is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Jul 2015
    Location
    UK
    Posts
    453
    Hi

    thanks for the reply, regretably the answer is no.
    Simply there is a colum marked entry number followed by an empty field

    I've pasted some lines below as an example

    As you can see each record/ marriage is made of of two lines in tejh spread sheet

    thanks

    Ian

    FicheRef PageNo EntryNo Date Year ForeName SurName Condition Occupation Abode Minister Notes
    D/P AX 2/1/3 1 1 15,22 & 29 Sep 1754 John Baker Shoemaker Axbridge Tuthill
    D/P AX 2/1/3 Avis ROWSEL spinster Axbridge
    D/P AX 2/1/3 1 2 20,27 Oct & 3 Nov 1754 James SWERSE Husbandman Axbridge J Tuthill & E Rebotier
    D/P AX 2/1/3 Francrs TANNER spinster Axbridge

  4. #4
    alansidman's Avatar
    alansidman is offline VIP
    Windows 7 32bit Access 2013
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,529
    I would amend the Excel spreadsheet to place the spouse (2nd record) on the same line as the first.

    This could be done with a simple loop macro. Assume that the second records are in column F, G and H of your spreadsheet.

    After running the following VBA script, then reimport into Access

    Code:
    Sub Bans()
        Dim i As Long
        Dim lr As Long
        lr = Range("F" & Rows.Count).End(xlUp).Row
        Range("M1") = "SpouseForename"
        Range("N1") = "SpouseSurName"
        Range("O1") = "SpouseCondition"
    
    
    Application.ScreenUpdating = False
    For i = 2 To lr
    If Range("E" & i) = "" Then
    Range("F" & i & ":H" & i).Copy Range("M" & i - 1)
    End If
    Next i
    Application.CutCopyMode = False
    
    
    For i = lr To 1 Step -1
    If Range("E" & i) = "" Then
    Range("E" & i).EntireRow.Delete
    End If
    Next i
    
    
    Application.ScreenUpdating = True
    Msgbox "completed"
    
    
    End Sub

  5. #5
    Jen0dorf is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Jul 2015
    Location
    UK
    Posts
    453
    Hi

    Many many thanks for the code -it's a bit over my knowledge level at the moment but I'll use it and try to understand

    cheers

    Ian

  6. #6
    alansidman's Avatar
    alansidman is offline VIP
    Windows 7 64bit Access 2013
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,529
    How to install your new code

    1. Copy the Excel VBA code
    2. Select the workbook in which you want to store the Excel VBA code
    3. Press Alt+F11 to open the Visual Basic Editor
    4. Choose Insert > Module
    5. Edit > Paste the macro into the module that appeared
    6. Close the VBEditor
    7. Save your workbook (Excel 2007+ select a macro-enabled file format, like *.xlsm)


    To run the Excel VBA code:
    1. Press Alt-F8 to open the macro list
    2. Select a macro in the list
    3. Click the Run button


  7. #7
    Jen0dorf is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Jul 2015
    Location
    UK
    Posts
    453
    Thanks a lot

    Ian

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

Similar Threads

  1. upload to excell
    By mujahid in forum Import/Export Data
    Replies: 11
    Last Post: 10-30-2013, 04:20 PM
  2. Getting values from Excell
    By JeroenMioch in forum Programming
    Replies: 1
    Last Post: 07-13-2012, 08:55 AM
  3. Exporting to excell help
    By stevanb in forum Access
    Replies: 1
    Last Post: 08-23-2011, 01:34 PM
  4. print to excell
    By Glenwood in forum Access
    Replies: 1
    Last Post: 05-10-2011, 06:56 AM
  5. Exporting Pivot Table to Excell - only want filtered records
    By Jennifer227 in forum Import/Export Data
    Replies: 1
    Last Post: 04-01-2011, 03:10 PM

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