G
Guest
Hi,
I have a form that has a List Box that displays Company Name, Phone #,
Contact, Work Type, etc. The Row Source for the List Box is as follows ("Subs
by Company" is a query):
SELECT [Subs by Company].Company, [Subs by Company].[Work Type], [Subs by
Company].Phone, [Subs by Company].Fax, [Subs by Company].[Contact #1], [Subs
by Company].[Labor Type], [Subs by Company].WorkID FROM [Subs by Company]
WHERE ((([Subs by Company].[Preferred Contractor])<>3));
I use the Double Click event procedure to open another form that displays
the Company information in greater detail. If there is a company with more
than one Work Type the List Box displays the same Company Name for each Work
Type. I'm having trouble when I click on a Company Name that has more than
one Work Type. The form displays the first (alphabetically) Work Type for
that particular Company when I double click the Company Name showing the
other Work Type. I tried playing around with the bound column numbers and
can't seem to be able to get it to work.
This is the code used for the List Box form:
---------------------------------------------------------------------------------------------
Private Sub LstJobNo_DblClick(Cancel As Integer)
On Error Resume Next
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "Sub List (Alpha by Company Name)1"
If Not IsNull(Me.LstJobNo) Then
stLinkCriteria = "[Company]=""" & Me.LstJobNo & """"
DoCmd.OpenForm stDocName, , , stLinkCriteria, , , Me.LstJobNo
Else
DoCmd.OpenForm stDocName
End If
End Sub
------------------------------------------------------------------
Private Sub Form_Load()
On Error Resume Next
'set base SQL strings for search
strSelect = "SELECT [Subs by Company].[WorkID], [Subs by Company].[Work
Type], " & _
"[Subs by Company].[Phone], " & _
"[Subs by Company].[Fax], " & _
"[Subs by Company].[Contact #1], " & _
"[Subs by Company].[Labor Type], " & _
"[Subs by Company].[Company], " & _
"[Subs by Company].[Sub ID]" & _
"FROM [Subs by Company]"
strWhereCurrent = "WHERE [Subs by Company].[Preferred Contractor]<>3"
End Sub
I have a form that has a List Box that displays Company Name, Phone #,
Contact, Work Type, etc. The Row Source for the List Box is as follows ("Subs
by Company" is a query):
SELECT [Subs by Company].Company, [Subs by Company].[Work Type], [Subs by
Company].Phone, [Subs by Company].Fax, [Subs by Company].[Contact #1], [Subs
by Company].[Labor Type], [Subs by Company].WorkID FROM [Subs by Company]
WHERE ((([Subs by Company].[Preferred Contractor])<>3));
I use the Double Click event procedure to open another form that displays
the Company information in greater detail. If there is a company with more
than one Work Type the List Box displays the same Company Name for each Work
Type. I'm having trouble when I click on a Company Name that has more than
one Work Type. The form displays the first (alphabetically) Work Type for
that particular Company when I double click the Company Name showing the
other Work Type. I tried playing around with the bound column numbers and
can't seem to be able to get it to work.
This is the code used for the List Box form:
---------------------------------------------------------------------------------------------
Private Sub LstJobNo_DblClick(Cancel As Integer)
On Error Resume Next
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "Sub List (Alpha by Company Name)1"
If Not IsNull(Me.LstJobNo) Then
stLinkCriteria = "[Company]=""" & Me.LstJobNo & """"
DoCmd.OpenForm stDocName, , , stLinkCriteria, , , Me.LstJobNo
Else
DoCmd.OpenForm stDocName
End If
End Sub
------------------------------------------------------------------
Private Sub Form_Load()
On Error Resume Next
'set base SQL strings for search
strSelect = "SELECT [Subs by Company].[WorkID], [Subs by Company].[Work
Type], " & _
"[Subs by Company].[Phone], " & _
"[Subs by Company].[Fax], " & _
"[Subs by Company].[Contact #1], " & _
"[Subs by Company].[Labor Type], " & _
"[Subs by Company].[Company], " & _
"[Subs by Company].[Sub ID]" & _
"FROM [Subs by Company]"
strWhereCurrent = "WHERE [Subs by Company].[Preferred Contractor]<>3"
End Sub