Results 1 to 8 of 8
  1. #1
    Two Gun is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2011
    Posts
    22

    Open form to specific record

    I'm working with Access 2010 and from a report, I want to use the On Click event with the "Title" control (on the report) to open my data entry form to the same record associated with the Title control.

    I'm using a macro:

    Form Name: Data Entry
    View: Form
    Filter Name: Blank (no entry)
    Where Condition: [Position Number]=[Reports]![SRC Report (Bureau)]! [Position Number]
    Date Mode: Edit
    Window Mode: Dialog

    This has worked and is working with a similar database, but when I click on the report control in this DB, the data entry form opens, but to the first record in the data set, not to the specific record where the [Position Number] fields match. Probably going to be one of those "duh" moments, but appreciate any help with this.

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    I don't use macros, only VBA. VBA easier to debug. However, the code looks okay to me. What could be different between the two projects that causes this one to fail?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    hertfordkc is offline 18 year novice
    Windows XP Access 2007
    Join Date
    Mar 2011
    Posts
    481
    Two guesses:
    1) there is a reference ambiguity in the where condition
    2) you need to requery

  4. #4
    Two Gun is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2011
    Posts
    22
    I've compared the two DBs and can find no differences. I've compacted & repaired the bad one with no success. I've looked at both report properties and form properties, with no apparent differences. I checked the references in each DB; they're identical. I don't have a clue why this simple macro does not perform in one DB and works flawlessly in the other ... and the "anguish" grows.

  5. #5
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    You tried the 'bad' one on other machines?

    Convert to VBA, see if that works better.

    If you want, provide project for analysis.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  6. #6
    boblarson is offline --------
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2011
    Posts
    1,272
    So you are using the Click event or Double-Click event on a report to open the form? First off, you might want to just make sure that it is passing the correct value you think it should. Substitute a macro to display a message box and the field.

    Also, make sure that you do not have the text box name the same as the field name on the report. If the field name is [Position Number] then name the control txtPositionNumber or something like that (best to avoid spaces or special characters in names or field names really).

    So once the text box has been changed, see if your original macro then works because it needs to reference the field but it may be failing because the field and text box are named the same.

  7. #7
    Two Gun is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2011
    Posts
    22

    Open form to specific record

    The control name and the control source were the same. I changed the name of the control and wouldn't you know it ... it works. Thanks guys for pointing me in the right direction.

  8. #8
    boblarson is offline --------
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2011
    Posts
    1,272
    Quote Originally Posted by Two Gun View Post
    The control name and the control source were the same. I changed the name of the control and wouldn't you know it ... it works. Thanks guys for pointing me in the right direction.
    Yeah, just a little extra info about that -

    Additionally, when using any formulas in a control source on a report, you should make sure that any of the controls bound to the individual fields are named something other than the name of the field or else you will get #Name as an error in the control.

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

Similar Threads

  1. Replies: 4
    Last Post: 04-20-2013, 10:12 AM
  2. Open form to a specific record from a query
    By chris.williams in forum Forms
    Replies: 11
    Last Post: 10-06-2011, 04:15 PM
  3. Open Form to Specific Record
    By batowl in forum Forms
    Replies: 1
    Last Post: 04-08-2011, 10:10 AM
  4. Replies: 1
    Last Post: 04-11-2010, 04:05 AM
  5. Replies: 3
    Last Post: 01-14-2010, 08:32 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