Go Back   Access World Forums > Microsoft Access Discussion > Forms

Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
Old 09-12-2019, 06:50 AM   #1
Newly Registered User
Join Date: Jun 2019
Posts: 35
Thanks: 0
Thanked 1 Time in 1 Post
IgnoranceIsBliss is on a distinguished road
Pass ID Of Row In Click Event

@arnelgp in another thread of mine gave me a function that would open a form filtered to show only the specific ID information for the row I clicked on my form.

My database became corrupted and I had to re-create it and now it is not working. In the double click event of the field on my form I have the code
=OpenNotes("ID", [Comments])
And I have that method coded like this
Public Function OpenNotes(pkName As String, pkValue As Variant)
Dim strWhere As String
Select Case TypeName(pkValue)
Case "String" Then
    strWhere = pkName & " = '" & pkValue & "'"
Case "Integer", "Long", "Double", "Single"
    strWhere = pkName & " = " & pkValue
Case "Date"
    StrWhere = pkName & " = #" & Format(pkValue, "mm/dd/yyyy") & "#"
End Select
DoCmd.OpenForm FormName:="theFormToOpen", View:=acNormal, WhereCondition:=strWhere
End Function
Now when I step thro the code, if I hover over pkName, I see
pkName = "ID"
pkValue = the value of comments
HOWEVER it is comments for all records, not for the ID of the clicked row. What did I set-up incorrectly here in the redo?

IgnoranceIsBliss is offline   Reply With Quote

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Double Click event not triggering After Update event George-Bowyer Modules & VBA 7 03-14-2019 11:50 PM
On Click event procedure skipping the On CLick code gblack Modules & VBA 3 05-06-2013 07:28 AM
pass list value to a text box on click event shutzy General 1 01-13-2012 01:51 AM
Form's Error Event takes precedence before Click event for Undo button Banana Forms 7 09-04-2008 04:15 PM
Click event has priority over exit event pbuethe Modules & VBA 5 06-22-2004 04:52 AM

All times are GMT -8. The time now is 10:56 AM.

Microsoft Access Help
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Featured Forum post

Sponsored Links

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World