Solved Function returning String not working

PatAccess

Registered User.
Local time
Today, 04:00
Joined
May 24, 2017
Messages
284
Hi Guys,
My function is not returning anything. what am I doing wrong here?
Code:
Private Sub Form_Load()
    Dim strSQLLst1 As String
'    strSQLLst1 = "SELECT LastOrdered,OrderNo,OrderedBy,SupplyCateg,VendorName,ItemNo,[Brand],[Color],[Size],MaxQt,MinQt "
'    strSQLLst1 = strSQLLst1 & "FROM QryTransactions ORDER BY LastOrdered"
    strSQLLst1 = SelectFromQryTransaction()
    Me.lstTransact1.RowSource = strSQLLst1
    Me.lstTransact1.Requery
End Sub

Private Function SelectFromQryTransaction() As String
    Dim strSQLLstRowSource As String
    strSQLLstRowSource = "SELECT LastOrdered,OrderNo,OrderedBy,SupplyCateg,VendorName,ItemNo,[Brand],[Color],[Size],MaxQt,MinQt "
    strSQLLstRowSource = strSQLLst1 & "FROM QryTransactions ORDER BY LastOrdered"
    SelectFromQryTransaction = strSQLLstRowSource
End Function
 
It should at least return just "from querytransactions ....."
You are mixing names in modules.

I see little point in doing this as well?
 
Have you tried stepping through it? Try going to the Immediate Window and type this? What happens?
Code:
?SelectFromQryTransaction()
 
Have you tried stepping through it? Try going to the Immediate Window and type this? What happens?
Code:
?SelectFromQryTransaction()
I don't why I forgot about stepping through it. There was a mistake in my function and it caught it. Thank you so much
 
Have you tried stepping through it? Try going to the Immediate Window and type this? What happens?
Code:
?SelectFromQryTransaction()
The new code is now
Code:
Private Sub Form_Load()
    Dim strSQLLst1 As String
'    strSQLLst1 = "SELECT LastOrdered,OrderNo,OrderedBy,SupplyCateg,VendorName,ItemNo,[Brand],[Color],[Size],MaxQt,MinQt "
'    strSQLLst1 = strSQLLst1 & "FROM QryTransactions ORDER BY LastOrdered"
    strSQLLst1 = SelectFromQryTransaction()
    Me.lstTransact1.RowSource = strSQLLst1
    Me.lstTransact1.Requery
End Sub

Private Function SelectFromQryTransaction() As String
    Dim strSQLLstRowSource As String
    strSQLLstRowSource = "SELECT LastOrdered,OrderNo,OrderedBy,SupplyCateg,VendorName,ItemNo,[Brand],[Color],[Size],MaxQt,MinQt "
    strSQLLstRowSource = strSQLLstRowSource & "FROM QryTransactions ORDER BY LastOrdered"
    SelectFromQryTransaction = strSQLLstRowSource
End Function
 
I don't why I forgot about stepping through it. There was a mistake in my function and it caught it. Thank you so much
Hi. Glad to hear you got it sorted out. Good luck with your project.
 

Users who are viewing this thread

Back
Top Bottom