Results 1 to 14 of 14
  1. #1
    ElRudi is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Nov 2011
    Posts
    14

    How to identify which record in a continuous form was clicked on?

    Hey all,

    I have a continuous form with an image and a text box on it. When the image is clicked, some text should appear in a text box. The problem is that the text appears in the text box of the incorrect record.

    Suppose the first record is the 'current' record (i.e., having the record selector to its left), and the user clicks on the image in the third record. Then the text appears in the first record, not the third.

    Is there a way to find out which of the records was clicked on? Or, can I change the current record to be the one whose image was clicked on?



    Thank you in advance!

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Clicking on the image is not selecting the record? This image is an ImageControl with a ControlSource? The textbox is bound? Do you want to 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.

  3. #3
    ElRudi is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Nov 2011
    Posts
    14
    Hey June7,

    Thanks for your quick reply!

    The form has a query bound to it, and the textbox is bound to one of its fields. The image's control source is something like '=IIF([PicA]=TRUE, "C:\picA.png", "C:\picB.png"), with an OnClick-event that writes to the textbox.

    Clicking on the image does not select the record.

    Let me know if you want me to provide a stipped version of the project for analysis!

    Ruud

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Yes, think I need to work with the project to analyse.
    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.

  5. #5
    ElRudi is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Nov 2011
    Posts
    14
    Alright,

    It was not so easy to reduce all below the 500kb limit but i managed

    Copy the 2 png files to the C:\ drive if you can, or change the image's control source to whereever you put them. Somehow they are shown much smaller than their original sizes - no idea why. But the main problem now is the one i described - clicking on one image fires the OnClick event in the current record, which is not necessarily the one that was clicked.

    Thanks!

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Zip files have a 2mb limit.

    The images are not downloading. That form does not have image controls. Just a single textbox with control source of SmsText
    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.

  7. #7
    ElRudi is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Nov 2011
    Posts
    14
    Hmmm.... to the left of the text box there should be an image control, with an OnClick-event coded in VBA... I'll zip it all up and add it to this post, including a screenshot of what it looks like on my PC.

    I'm off to bed now, so take your time

    Thanks again

  8. #8
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Guess the image control was there, just didn't recognize it because image so small. I set the SizeMode property to Zoom and the image enlarged.

    Annoying, clicking on the image control will not select the record. Something MS needs to work on?

    The code does run but odd thing is it doesn't stop on a breakpoint. Breakpoint didn't work in any procedure I wrote. Weird.

    I changed the Requery to Refresh so it stays on the record I selected by clicking in textbox.

    Only thing I can suggest is to put next to the image control a Toggle button bound to the IsSpecial field then Me.Refresh code in its click event. The Image click event would not be needed.
    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.

  9. #9
    ElRudi is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Nov 2011
    Posts
    14

  10. #10
    ElRudi is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Nov 2011
    Posts
    14
    Alright, no problem - thanks for tbe effort!

    i guess i'll have to figure out some workaround - maybe a transparent non-bound textbox on top of the image which catches the click event...

    Or maybe someone else has a solution?

    Thanks again!

    R

  11. #11
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    I tried that. When you click in a textbox, even if set as transparent, it becomes opaque until you leave it. I also tried a rectangle graphic. A bound toggle button (or a checkbox, but can't size them) the only workaround I can see.
    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.

  12. #12
    ElRudi is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Nov 2011
    Posts
    14
    Ah i see... maybe I can put focus on another cqntrol as soon as the text box is clicked, though that might cause a small 'glitch'/flash of the text box appearing/disappearing whenever the user clicks it.

    I'll play around with it a bit and let you know how I solved it.

  13. #13
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Thought about the checkbox again. Can't size the checkbox itself but can size the check area. Don't actually have to click right on the little checkbox itself. Can click anywhere inside the control frame or on a label associated with the checkbox. So you can size its label to frame the star image but size the checkbox frame so small the checkbox can't be seen. When click the label, a dotted outline will display but the checkbox doesn't show. Don't put any caption on the label. Actually, clicking label associated with button control will also execute the click event, but don't get a dotted outline.

    Will this be acceptable compromise?
    Last edited by June7; 11-08-2011 at 01:32 PM.
    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.

  14. #14
    ElRudi is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Nov 2011
    Posts
    14
    Yes, that will be acceptable, and works just fine - thanks!

    I noticed an image control cannot be given focus; i guess this is why clicking one does not make it the current record.

    Thanks again for your help!

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

Similar Threads

  1. Get position of record in continuous form
    By Whizbang in forum Forms
    Replies: 3
    Last Post: 11-02-2011, 01:47 PM
  2. Replies: 1
    Last Post: 02-17-2011, 06:23 AM
  3. Replies: 1
    Last Post: 11-09-2010, 03:02 PM
  4. Suppress new record on continuous forms
    By ajetrumpet in forum Forms
    Replies: 0
    Last Post: 09-07-2010, 09:30 PM
  5. Continuous Form
    By duckie10 in forum Access
    Replies: 13
    Last Post: 06-09-2009, 11:15 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