craigachan
Registered User.
- Local time
- Today, 06:55
- Joined
- Nov 9, 2007
- Messages
- 282
I have a cmdbutton on Form1 that calls a public function that opens a separate form2 and then populates Form2.listbox. It seems like I've done this before, but this time the code runs but the listbox populates with no data.
Code:
Private Sub cmdChartNote_Click()
DoCmd.OpenForm "SelectChartNote"
Forms!SelectChartNote!PID = Me.PID
Call BuildListOfChartNotes(Me.PID) 'LtrPublic
End Sub
/[Code]
{Code}
Public Function BuildListOfChartNotes(strPID As String)
On Error GoTo BuildListOfChartNotesErr
Dim msql As String
Forms!SelectChartNote!PID = strPID
With Forms!SelectChartNote!lstNotes
msql = "SELECT nDate, nNote, nID, nPID, nType FROM ChartNotes WHERE nPID = '" & strPID & "'"
'MsgBox msql
.ColumnCount = 5
.ColumnWidths = "0.6in, 4.5in, 1in, 0.4in, 0.4in"
.RowSource = msql
End With
BuildListOfChartNotesExit:
Exit Function
BuildListOfChartNotesErr:
MsgBox "LtrPublic-BuildListOfChartNotes: " & Err.Number & " - " & Err.Description
Resume BuildListOfChartNotesExit
End Function
/{Code}
The code runs without errors....but not data in the listbox. any ideas why?
Thanks for your help.