+ Post New Thread
Results 1 to 4 of 4
Office Software Thread, Access - Macro performing differently on different forms/reports in Technical; I have a macro that makes a displayed record click-able in turn opening the record in a new window for ...
  1. #1

    CHR1S's Avatar
    Join Date
    Feb 2006
    Location
    Birmingham
    Posts
    4,489
    Thank Post
    1,575
    Thanked 479 Times in 302 Posts
    Rep Power
    215

    Access - Macro performing differently on different forms/reports

    I have a macro that makes a displayed record click-able in turn opening the record in a new window for editing.

    Code:
    If IsNull([AssetID]) Then
             Beep
    Edit If
    
    If Not IsNull([AssetID]) Then
          Open Form
                    Assets
          Where Condition = = "[AssetID]"
             Window Mode Dialog
         OnError
                   Go to Next
         Requery
    End It
    It works as expected when displaying a report, but when called from a form the macro always pulls record 1 despite the item clicked. All data is pulled from the same table using the same macro so in theory should just work.

    Cant for the life of me see why!

    Anyone else spot the error?

  2. #2

    CHR1S's Avatar
    Join Date
    Feb 2006
    Location
    Birmingham
    Posts
    4,489
    Thank Post
    1,575
    Thanked 479 Times in 302 Posts
    Rep Power
    215
    Oh and the tag is -

    HyperlinkToDetails~FormName=Assets~SourceID=AssetI D

  3. #3

    CHR1S's Avatar
    Join Date
    Feb 2006
    Location
    Birmingham
    Posts
    4,489
    Thank Post
    1,575
    Thanked 479 Times in 302 Posts
    Rep Power
    215
    Argh! And now my reports have stopped displaying the clicked link and just show record 1! D'oh

  4. #4

    CHR1S's Avatar
    Join Date
    Feb 2006
    Location
    Birmingham
    Posts
    4,489
    Thank Post
    1,575
    Thanked 479 Times in 302 Posts
    Rep Power
    215
    For anyone following I rewrote it as code instead of macro and it worked.

    Private Sub Text25_Click()
    Dim stDocName As String
    Dim stLinkCriteria As String

    stDocName = "Assets"
    stLinkCriteria = "[AssetID]=" & Me![AssetID]

    DoCmd.OpenForm stDocName, acNormal, , stLinkCriteria, acFormEdit, acWindowNormal


    End Sub

SHARE:
+ Post New Thread

Similar Threads

  1. Opinions on different VLEs
    By HodgeHi in forum Virtual Learning Platforms
    Replies: 37
    Last Post: 10th August 2011, 10:28 AM
  2. Replies: 10
    Last Post: 1st December 2009, 11:04 AM
  3. Uniservity on different browsers
    By Quatermass in forum Virtual Learning Platforms
    Replies: 8
    Last Post: 16th June 2008, 02:47 PM
  4. Eg_brown Template looks different on 1.5
    By SimpleSi in forum EduGeek Joomla 1.5 Package
    Replies: 3
    Last Post: 22nd May 2008, 10:31 AM
  5. using 2 dhcp servers on different ranges & domains
    By chrisjako in forum Wireless Networks
    Replies: 10
    Last Post: 6th February 2008, 04:28 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •