Populating a list box

K

Ken

Hello all:

I'm working with a membeship database with a series of dates on it. I
want to create a list in a listbox of member's names based on the
dates entered. The list would then be used to select one individual to
display in a form with a subform showing rows from an associated table
(one to many from member to associated table).

There is a button on the first form with the two dates, here's the
code underlying that button:

Private Sub Command8_Click()
On Error GoTo Err_Command8_Click

Dim stDocName As String
Dim stLinkCriteria As String

stFromDate = "01/01/1900"
stToDate = "12/31/2099"

If [Text10] > " " Then
stFromDate = [Text10]
End If

If [Text12] > " " Then
stToDate = [Text12]
End If
stDocName = "f_fellow_select_list"

stLinkCriteria = " [member_info.fellowship_dt] between #" &
stFromDate & "# and #" & stToDate & "#"
DoCmd.OpenForm stDocName, , , stLinkCriteria



Exit_Command8_Click:
Exit Sub

Err_Command8_Click:
MsgBox Err.Description
Resume Exit_Command8_Click

End Sub


When I execute the command, I get a list box back in
f_fellow_select_list, but it includes all of the members, not just
those with the specific date range. The form with the list box works,
it properly displays the results on the form/subform.

The list box I'm trying to populate is unbound, the form
(f_fellow_select_list) is bound to this query:

SELECT (Member_info.Last_name+', '+member_info.first_name) AS Expr1,
Member_Info.ID_Number, Member_Info.Fellowship_Dt AS f_date,
Member_Info.Mastership_Dt AS m_date
FROM Member_Info
ORDER BY 1;

Only the first column is displayed in the list box.

What am I missing. I hope I've provided enough info to get this
resolved.

TIA

Ken Halpern
Margate FL
 
B

BigDawg

it appears the maybe your select statement is missing a where clause = to
your stLinkCriteria which should filter down your list.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top