B
BruDe
Guess I got too far down the list
when I try to run it. I now get and error
message: "object required." VBA will accept the code now
though. here is what I have now:
Private Sub BrokerID_AfterUpdate()
Dim strSQL As String
strSQL = "Select" & Me!BrokerID
strSQL = strSQL & "from LoanOfficer" ' this is the
table where Loan Officer and Broker are joined
Me!LoanOfficerID.RowSourceType = "Table/Query"
Me!LoanOfficerIDRowSource = strSQL
LoanOfficerComboName.RowSource = "Select
[LoanOfficer].[LoanOfficerID],[LoanOfficer].
[LoanOfficerFirstName] & ' ' & [LoanOfficer].
[LoanOfficerLastName] FROM [LoanOfficer] Where
[LoanOfficer].[BrokerID] = " & Me![BrokerID] & " Order by
[LoanOfficerLastName] & ' ' & [FirstName];"
I've tried it both ways, with and without the strSQL
statements with the same results. Seems I need to have an
additional Dim statement to call an object on the form, or
in the table, I'm not sure which.
when I try to run it. I now get and error
message: "object required." VBA will accept the code now
though. here is what I have now:
Private Sub BrokerID_AfterUpdate()
Dim strSQL As String
strSQL = "Select" & Me!BrokerID
strSQL = strSQL & "from LoanOfficer" ' this is the
table where Loan Officer and Broker are joined
Me!LoanOfficerID.RowSourceType = "Table/Query"
Me!LoanOfficerIDRowSource = strSQL
LoanOfficerComboName.RowSource = "Select
[LoanOfficer].[LoanOfficerID],[LoanOfficer].
[LoanOfficerFirstName] & ' ' & [LoanOfficer].
[LoanOfficerLastName] FROM [LoanOfficer] Where
[LoanOfficer].[BrokerID] = " & Me![BrokerID] & " Order by
[LoanOfficerLastName] & ' ' & [FirstName];"
I've tried it both ways, with and without the strSQL
statements with the same results. Seems I need to have an
additional Dim statement to call an object on the form, or
in the table, I'm not sure which.
-----Original Message-----
I forgot about the quotes around the space in the order by [lastname]I deleted the previous cose and inserted your suggested
statment in the code. It is as follows:
LoanOfficerComboName.RowSource = "Select[LoanOfficer].
[LoanOfficerID],[LoanOfficer].[LoanOfficerFirstName] & " "
& [LoanOfficer].[LoanOfficerLastName] FROM [LoanOfficer]
Where [LoanOfficer].[BrokerID] = " & Me![BrokerID & "
Order by [LoanOfficerLastName] & " " & [FirstName];"
But when I try to save it, or go to the next line, I get a
compile error message "expected: end of statement" up to
this point: & Me![BrokerID & " Order by
[LoanOfficerLastName] & " " & [FirstName];"
*** snipped **My fault ...!
& " " & [firstname]
Change just those double quotes to single quotes.
Where [LoanOfficer].[BrokerID] = " & Me![BrokerID & "
Order by [LoanOfficerLastName] & ' ' & [FirstName];"