- Local time
- Today, 18:41
- Joined
- Sep 28, 2010
- Messages
- 83
Morning..
I have two listboxes, both doing similar things (displaying commitments against properties/suppliers)..
The first listbox is a list driven by a query and can be double clicked to launch a display/edit form.. This works without issue.
The 2nd listbox within a form which is called from a "search" form. The submit button on the search form amends the query used to populate the listbox.
These parts all work perfectly. However, attempting to doubleclick on a record in the 2nd listbox seems to fail to pass a value to Me!List1 (yes, it's called list1, but is the 2nd listbox (just had a thought, they're both called List1, but are on different forms, is there an issue here (other than logical or sense) )..
So, when attempting to execute this VB
It fails as Me!List1 is Null, leading to stLinkCriteria being Null and the TCA Dlookup failing as well..
The two processes for each of the listboxes are EXACTLY the same, the only difference between the two is a change in rowsource for the 2nd listbox..
Help!?
I have two listboxes, both doing similar things (displaying commitments against properties/suppliers)..
The first listbox is a list driven by a query and can be double clicked to launch a display/edit form.. This works without issue.
The 2nd listbox within a form which is called from a "search" form. The submit button on the search form amends the query used to populate the listbox.
These parts all work perfectly. However, attempting to doubleclick on a record in the 2nd listbox seems to fail to pass a value to Me!List1 (yes, it's called list1, but is the 2nd listbox (just had a thought, they're both called List1, but are on different forms, is there an issue here (other than logical or sense) )..
So, when attempting to execute this VB
Code:
Private Sub List1_DblClick(Cancel As Integer)
'Open Commitment in Commitment Display Form (Read Only)
Dim stLinkCriteria As String
Dim ALimit, TCA As Double
stLinkCriteria = "ID=" & Me!List1
ALimit = DLookup("Authlimit", "tblstaff", "Userid='" & Environ("username") & "'")
TCA = DLookup("TotalContractAmount", "tblCommitments", " ID=" & Me!List1 & "")
If ALimit > TCA Then
If DLookup("Authorised", "tblCommitments", " ID=" & Me!List1 & "") = -1 Then
DoCmd.OpenForm "frmCommitmentDisplay", , , stLinkCriteria, acFormReadOnly
Else
DoCmd.OpenForm "frmCommitmentApprove", , , stLinkCriteria, acFormReadOnly
End If
Else
DoCmd.OpenForm "frmCommitmentDisplay", , , stLinkCriteria, acFormReadOnly
End If
End Sub
It fails as Me!List1 is Null, leading to stLinkCriteria being Null and the TCA Dlookup failing as well..
The two processes for each of the listboxes are EXACTLY the same, the only difference between the two is a change in rowsource for the 2nd listbox..
Help!?