Results 1 to 6 of 6
  1. #1
    dbprogman is offline Novice
    Windows 7 Access 2007
    Join Date
    Jul 2010
    Posts
    8

    Record Selecting

    Situation:



    I have form with two (2) datasheet subforms data1, data2 both subforms are based on the same record source. The reason for this is that the company commissioning this database dont want to have to scroll across to view records.

    Problem:

    The problem I am having is that I need some code that will allow a record to be selected (highlighted) in data2 when the corrosponding record has been selected in data1 and visa versa.

    So far I have come up with the following code but it doesn't seem to work.

    Dim rs As Object
    On Error GoTo Form_Current_Error
    Set rs = [data2].RecordsetClone
    rs.FindFirst "[fileID] = " & Me.fileID
    If Not rs.EOF Then [data2].Bookmark = rs.Bookmark
    '
    On Error GoTo 0
    Exit Sub
    Form_Current_Error:

    Exit Sub

    In advance thanks for your help and hopefully a solution is possible.

  2. #2
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    what's the goal here? 2 sets with the same source on the same for is strange, but I've seen stranger things. do you want to SELECT the same rec when a rec from set 1 is selected? SELECT, as in, HIGHLIGHT it only?

    that seems pointless, really.

  3. #3
    dbprogman is offline Novice
    Windows 7 Access 2007
    Join Date
    Jul 2010
    Posts
    8

    RE: Record selecting

    Ok, you may see this as a little strange but it is rather effective outside of the current issue.

    Firstly the form had one (1) datasheet subform with a number of fields being displayed. A user was required to scroll across to view all fields and their content. This was deemed unproductive and the client wanted to view all records on the form at once without the need to resize or scroll.

    Therefore my solution was to build two(2) datasheet subforms using the same record source but displaying different fields. I find it difficult to understand why this would be considered strange? As this has solved the issue beautifully and allows the client to view all fields without any need to scroll (except vertically) or resize columns to see all.

    Also I dont understand your comment that highlighting the corrosponding record in data2 would be pointless, if there are e.g 100 records and a user selects record 80 in data1 then it would be fair to expect data2 to also dispaly record 80 not record 1 as it current does.

    My issue is that if a record is highlighted in the first datasheet form the corrosponding record in datasheet two is also highlighted.

    If this is totally the wrong approach to this problem I am open to suggestions....

    NB: Having a form with just one datasheet form on it is not an option as the client requested other controls on the form in conjuction with these datasheets.

  4. #4
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    Quote Originally Posted by dbprogman View Post
    Therefore my solution was to build two(2) datasheet subforms using the same record source but displaying different fields. I find it difficult to understand why this would be considered strange?
    i didn't know that is what you mean. that is not normal at all, and it's actually as unproductive as possible. If you think about it in common sense terms, why would two subforms be able to show every field of a dataset if one can't?? That makes no sense at all.

    Wouldn't the need for two subforms be the same thing as expanding the first subform's size to fit for full visibility? I would recommend that you do that first. This scenario should never be needed.

    and as far as expanding the subform object to give view of all fields, that will apparently satisfy the client as well, as you have already stated.

  5. #5
    dbprogman is offline Novice
    Windows 7 Access 2007
    Join Date
    Jul 2010
    Posts
    8
    Wouldn't the need for two subforms be the same thing as expanding the first subform's size to fit for full visibility? I would recommend that you do that first. This scenario should never be needed.

    You either didn't read my post or you don't understand what I am attempting to achieve.

    How could having two subforms be the same as having one? In my previous post I attempted to explain that I cannot have a subform that requires horizontal scrolling. Instead of one subform with ten (10) fields I have two subforms with five (5) fields each.

    if user chooses record 1 in datasheet1 then
    highlight record 1 in datasheet2

    I really dont know how to explain myself any easier, sorry.

  6. #6
    dbprogman is offline Novice
    Windows 7 Access 2007
    Join Date
    Jul 2010
    Posts
    8

    Problem Solved!

    in the OnCurrent event of sub form Data1..

    dim id_d1 as long
    id_d1 = me.fileID

    Forms![YourMainForm].SubFormData2.form.SetFocus
    DoCmd.FindRecord id_d1

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

Similar Threads

  1. Selecting Dates
    By jpalk in forum Queries
    Replies: 3
    Last Post: 05-21-2010, 06:08 AM
  2. Selecting between two dates
    By nicorvp in forum Queries
    Replies: 5
    Last Post: 05-04-2010, 08:17 AM
  3. Selecting next set of control No's
    By newtoAccess in forum Queries
    Replies: 0
    Last Post: 02-28-2010, 10:28 AM
  4. Selecting Just One Name Type
    By susan in forum Queries
    Replies: 1
    Last Post: 12-03-2009, 12:08 PM
  5. Help with Selecting a single record in access.
    By rfhall50 in forum Programming
    Replies: 3
    Last Post: 08-10-2009, 08:50 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