IgnoranceIsBliss
Registered User.
- Local time
- Yesterday, 17:49
- Joined
- Jun 13, 2019
- Messages
- 35
@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
And I have that method coded like this
Now when I step thro the code, if I hover over pkName, I see
And
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?
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
Code:
=OpenNotes("ID", [Comments])
And I have that method coded like this
Code:
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
Code:
pkName = "ID"
And
Code:
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?