A
Anthony Webb
I have two list boxes on my form and have the following
code on the On Current Event:-
Private Sub Form_Current()
Dim sqlstr1 As String, sqlstr2 As String
sqlstr1 = "SELECT [Learning Programme Dataset].LEARN_ID, "
sqlstr1 = sqlstr1 & " [Learning Programme
Dataset].PROVI_ID,"
sqlstr1 = sqlstr1 & " [Learning Programme
Dataset].lprog_id,"
sqlstr1 = sqlstr1 & " [Learning Programme Dataset].
[type_lpg], "
sqlstr1 = sqlstr1 & " [Learning Programme
Dataset].isf_LPROGSTART,"
sqlstr1 = sqlstr1 & " [Learning Programme
Dataset].isf_dueend,"
sqlstr1 = sqlstr1 & " [Learning Programme
Dataset].isf_actualenddate"
sqlstr1 = sqlstr1 & " FROM [Learning Programme Dataset]"
sqlstr1 = sqlstr1 & " WHERE [Learning Programme
Dataset].LEARN_ID = '" & Me.[LEARN_ID] & "'"
sqlstr1 = sqlstr1 & " AND [Learning Programme
Dataset].Provi_id = '" & Me.[PROVI_ID] & "';"
Me.List20.RowSource = sqlstr1
sqlstr2 = "select [Learning Activity Dataset].learn_id,"
sqlstr2 = sqlstr2 & " [Learning Activity
Dataset].PROVI_ID,"
sqlstr2 = sqlstr2 & " [Learning Activity
Dataset].lprog_id,"
sqlstr2 = sqlstr2 & " [Learning Activity
Dataset].Lacti_id,"
sqlstr2 = sqlstr2 & " [Learning Activity
Dataset].Laim_ref,"
sqlstr2 = sqlstr2 & " [Learning Activity
Dataset].Title_la,"
sqlstr2 = sqlstr2 & " [Learning Activity
Dataset].Startdte,"
sqlstr2 = sqlstr2 & " [Learning Activity
Dataset].eenddate,"
sqlstr2 = sqlstr2 & " [Learning Activity
Dataset].termdate,"
sqlstr2 = sqlstr2 & " From [Learning Activity Dataset]"
sqlstr2 = sqlstr2 & " Where [Learning Activity
Dataset].learn_id = '" & Me.Text22 & "'"
sqlstr2 = sqlstr2 & " and [Learning Activity
Dataset].provi_id = '" & Me.Text24 & "'"
sqlstr2 = sqlstr2 & " and [Learning Activity
Dataset].lprog_id = '" & Me.Text26 & "';"
Me.List18.RowSource = sqlstr2
I believe the problem lies in the first bit where i have
put: Dim sqlstr1 As String, sqlstr2 As String
As if i delete the first part sqlstr1 as string and insert
sqlstr2 as string instead and the delete all of code
relating to the first list box, iot works fine.
It is only when i have the code for both that it does not
work.
I keep getting the following statement:
The Select statement includes a reserved word or an
argument name that is mispelled or missing, or the
punctuation is incorrect.
Any Ideas?
Thanks Everyone
Anthony
code on the On Current Event:-
Private Sub Form_Current()
Dim sqlstr1 As String, sqlstr2 As String
sqlstr1 = "SELECT [Learning Programme Dataset].LEARN_ID, "
sqlstr1 = sqlstr1 & " [Learning Programme
Dataset].PROVI_ID,"
sqlstr1 = sqlstr1 & " [Learning Programme
Dataset].lprog_id,"
sqlstr1 = sqlstr1 & " [Learning Programme Dataset].
[type_lpg], "
sqlstr1 = sqlstr1 & " [Learning Programme
Dataset].isf_LPROGSTART,"
sqlstr1 = sqlstr1 & " [Learning Programme
Dataset].isf_dueend,"
sqlstr1 = sqlstr1 & " [Learning Programme
Dataset].isf_actualenddate"
sqlstr1 = sqlstr1 & " FROM [Learning Programme Dataset]"
sqlstr1 = sqlstr1 & " WHERE [Learning Programme
Dataset].LEARN_ID = '" & Me.[LEARN_ID] & "'"
sqlstr1 = sqlstr1 & " AND [Learning Programme
Dataset].Provi_id = '" & Me.[PROVI_ID] & "';"
Me.List20.RowSource = sqlstr1
sqlstr2 = "select [Learning Activity Dataset].learn_id,"
sqlstr2 = sqlstr2 & " [Learning Activity
Dataset].PROVI_ID,"
sqlstr2 = sqlstr2 & " [Learning Activity
Dataset].lprog_id,"
sqlstr2 = sqlstr2 & " [Learning Activity
Dataset].Lacti_id,"
sqlstr2 = sqlstr2 & " [Learning Activity
Dataset].Laim_ref,"
sqlstr2 = sqlstr2 & " [Learning Activity
Dataset].Title_la,"
sqlstr2 = sqlstr2 & " [Learning Activity
Dataset].Startdte,"
sqlstr2 = sqlstr2 & " [Learning Activity
Dataset].eenddate,"
sqlstr2 = sqlstr2 & " [Learning Activity
Dataset].termdate,"
sqlstr2 = sqlstr2 & " From [Learning Activity Dataset]"
sqlstr2 = sqlstr2 & " Where [Learning Activity
Dataset].learn_id = '" & Me.Text22 & "'"
sqlstr2 = sqlstr2 & " and [Learning Activity
Dataset].provi_id = '" & Me.Text24 & "'"
sqlstr2 = sqlstr2 & " and [Learning Activity
Dataset].lprog_id = '" & Me.Text26 & "';"
Me.List18.RowSource = sqlstr2
I believe the problem lies in the first bit where i have
put: Dim sqlstr1 As String, sqlstr2 As String
As if i delete the first part sqlstr1 as string and insert
sqlstr2 as string instead and the delete all of code
relating to the first list box, iot works fine.
It is only when i have the code for both that it does not
work.
I keep getting the following statement:
The Select statement includes a reserved word or an
argument name that is mispelled or missing, or the
punctuation is incorrect.
Any Ideas?
Thanks Everyone
Anthony