Listbox Won't Populate

TheSearcher

Registered User.
Local time
Today, 01:40
Joined
Jul 21, 2011
Messages
383
I have the following code behind a command button. tbl_CogNote gets populated by the Insert query. This works. But lst_Goals never gets populated. It remains blank. I've done this a thousand times in the past with no issues. What am I missing?

Private Sub cmd_Submit_Click()

Dim sql1, sql2 As String

sql1 = "Insert Into tbl_CogNote(Client_ID, Client_Name, Goal_Number, Goal, Task, Cue, Performance, Note_Date) "
sql1 = sql1 & "Select '" & cmb_Client.Column(0) & "', '" & cmb_Client.Column(1) & "', '" & cmb_Goals.Column(0) & "', '" & cmb_Goals.Column(1) & "', '" & txt_Task.Value & "', '" & cmb_Cue.Value & "', '" & txt_Performance.Value & "', date()"
DoCmd.SetWarnings False
DoCmd.RunSQL sql1
DoCmd.SetWarnings True

sql2 = "SELECT tbl_CogNote.Client_ID, tbl_CogNote.Client_Name, tbl_CogNote.Goal_Number, tbl_CogNote.Goal, tbl_CogNote.Task, tbl_CogNote.Cue, tbl_CogNote.Performance"
sql2 = sql2 & "FROM tbl_CogNote "
sql2 = sql2 & "WHERE (((tbl_CogNote.Client_ID) = '100001')) "
sql2 = sql2 & "ORDER BY tbl_CogNote.Goal_Number;"
Me.lst_Goals.RowSource = sql2
Me.lst_Goals.Requery

End Sub
 
Hi. Try doing a Debug.Print sql2 and then copy and paste it to the query designer to see if it returns any records.
 
Yes. It does return records.
 
add space:

sql2 = sql2 & " FROM tbl_CogNote "
 
beauty is in the eyes of the beholder!
good luck!
 

Users who are viewing this thread

Back
Top Bottom