Results 1 to 11 of 11
  1. #1
    paddon is offline Novice
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Dec 2010
    Posts
    24

    Form Launch Problem

    Hello,

    I have a form which essentially just displays some data from a table "Contacts" in a datasheet view. This form is named "Contact List" and looks like follows:

    Code:
     OwnersID  |   Info1   |   Info2   
    555  |           |
    I also have another form, "Contact Detail", which is a dialog form that displays all of the information from the Properties table in a nice easy to read/edit format. I would like to create a link such that when one clicks the ID number of a particular entry in the "Contact List" form it executes the "Contact Detail" form, showing the relevant record. For example if one were to click the 555 above the "Contact Details" form would launch and the record showing on that form is that which has the ID # 555.

    Any thoughts as to how one might accomplish this best?

    Thanks,


    Paddon

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,642
    This type of thing?

    BaldyWeb wherecondition
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    paddon is offline Novice
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Dec 2010
    Posts
    24
    pbaldy, thanks for the help... what I am trying to accomplish is exactly like that, however, I found a similar tutorial before and alas this one generates the same error. Both Forms use the same table, the primary key of which is known as "[OwnersID]".

    I named the field that one clicks on the first form "ID". This field contains the primary key [OwnersID].

    Here is the code I using:

    Code:
    Private Sub ID_Click()
    
    Dim rs As Object
    Dim lngBookmark As Long
    
    'set a variable to the current record
    lngBookmark = Me.ID
    'open the new form
    DoCmd.OpenForm "Contact Details"
    
    'take it to the selected record
    Set rs = Forms![Contact Details].RecordsetClone
    rs.FindFirst "[OwnersID] = " & lngBookmark
    Forms![Contact Details].Bookmark = rs.Bookmark
    
    Set rs = Nothing
    
    End Sub
    The error I get after clicking is as follows:

    The expression On Click you entered as the event property setting produced the following error: A problem occurred while Microsoft Access was communicating with the OLE Server or ActiveX Control.

    * The expression may not result in the name of a macro, the name of a user defined function, or [Event Procedure]
    * There may have been an error evaluating the function, event or macro.
    When I click show help is says

    This error occurs when an event has failed to run because Microsoft Office Access cannot evaluate the location of the logic for the event. For example, if the OnOpen property of a form is set to =[Field], this error occurs because Access expects a macro or event name to run when the event is fired.

    Any ideas as to what might be causing this error?

    Thanks,
    Paddon

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,642
    That treats OwnerID as a numeric field; is it? Can you post the db?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    paddon is offline Novice
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Dec 2010
    Posts
    24
    Yes absolutely. I only have dummy data in it at this point.

    http://www.filehosting.org/file/deta...ase2_tmp.accdb

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,642
    Will it post here, after compacting and zipping? I'd rather not register for another site.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  7. #7
    paddon is offline Novice
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Dec 2010
    Posts
    24
    Unfortunately it is 2.51MB. Try this link I don't think you'll need to sign up, you just need to wait 20 seconds.

    http://www.4shared.com/file/5LKfvZVU..._Database.html

  8. #8
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,642
    I think that form may have gotten corrupted or something. I threw together another and this code worked as expected:

    Code:
    Dim rs As Object
    Dim lngBookmark As Long
    
    'set a variable to the current record
    lngBookmark = Me.OwnersID
    'open the new form
    DoCmd.OpenForm "Contact Details"
    
    'take it to the selected record
    Set rs = Forms![Contact Details].RecordsetClone
    rs.FindFirst "[OwnersID] = " & lngBookmark
    Forms![Contact Details].Bookmark = rs.Bookmark
    
    Set rs = Nothing
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  9. #9
    paddon is offline Novice
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Dec 2010
    Posts
    24
    pbaldy, you are right. I created the form from scratch again and it is working quite well now. I assumed it was my implementation of the code since I am not a great programmer.

    Thanks so much for your help!

  10. #10
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,642
    No problem, glad you got it sorted out. Sometimes a form just goes goofy like that, but not often.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  11. #11
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Do you want to go ahead and use the Thread tool and mark this thread as Solved? FYI: If you Compact and Repair *before* zipping a file you might be surprised how small the file really is.

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

Similar Threads

  1. Replies: 2
    Last Post: 06-14-2010, 03:25 PM
  2. Replies: 5
    Last Post: 03-03-2010, 12:03 PM
  3. Replies: 0
    Last Post: 08-26-2008, 09:22 AM
  4. Replies: 0
    Last Post: 01-18-2007, 07:07 PM
  5. HOW DO I: Add or Launch Report from a Form?
    By ba1959nh in forum Forms
    Replies: 2
    Last Post: 09-25-2006, 04:33 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