B
Bill Case
I have a table with some 20,000 records of residential
addresses in a particular community. I have a report to
print lists of addresses on a particular street,
designated by the user.
I created a form with a combo box that looks up the
available street names from a table, displays a list of
unique street names, uses a SQL statement to apply the
chosen street to a query, and launches a report with the
results.
The purpose of the form is to provide the user with a
combo box from which he can select the street name, then
click the button to launch the report. Here's what the
button does:
-------
Private Sub Command13_Click()
Dim strSQLWhere As String
If IsNull(Me.Combo8) = False Then
strSQLWhere = "StreetName = '" & Me.Combo8 & "'"
End If
DoCmd.OpenReport "Entire List - All Addresses",
acViewPreview, , strSQLWhere
DoCmd.Maximize
End Sub
-------
The only way I have been able to make this work is to
make the source of the combo box (Combo8, as seen above)
be a table ("Streets") that includes only street names.
The problem with this is, if new records are added, I
have to make sure any new street names are also added to
the "Streets" table.
If I designate the source of the combo box to be the main
table (called "Details"), when I pull down the combo box,
I get hundreds of the same street name repeated (which
makes sense, I understand, since each is related to an
individual record in the table I'm referencing).
Question: Is there a way to restrict the combo box to
show only a single instance of the street name (that is,
unique names) from the Details table? Alternatively, is
there a way to somehow autocreate a subtable of just the
street names that gets updated whenever data is entered
into the Details table? (I realize this part of my
question is outside the scope of the "forms" newsgroup.)
Thank you in advance for any help you can offer.
addresses in a particular community. I have a report to
print lists of addresses on a particular street,
designated by the user.
I created a form with a combo box that looks up the
available street names from a table, displays a list of
unique street names, uses a SQL statement to apply the
chosen street to a query, and launches a report with the
results.
The purpose of the form is to provide the user with a
combo box from which he can select the street name, then
click the button to launch the report. Here's what the
button does:
-------
Private Sub Command13_Click()
Dim strSQLWhere As String
If IsNull(Me.Combo8) = False Then
strSQLWhere = "StreetName = '" & Me.Combo8 & "'"
End If
DoCmd.OpenReport "Entire List - All Addresses",
acViewPreview, , strSQLWhere
DoCmd.Maximize
End Sub
-------
The only way I have been able to make this work is to
make the source of the combo box (Combo8, as seen above)
be a table ("Streets") that includes only street names.
The problem with this is, if new records are added, I
have to make sure any new street names are also added to
the "Streets" table.
If I designate the source of the combo box to be the main
table (called "Details"), when I pull down the combo box,
I get hundreds of the same street name repeated (which
makes sense, I understand, since each is related to an
individual record in the table I'm referencing).
Question: Is there a way to restrict the combo box to
show only a single instance of the street name (that is,
unique names) from the Details table? Alternatively, is
there a way to somehow autocreate a subtable of just the
street names that gets updated whenever data is entered
into the Details table? (I realize this part of my
question is outside the scope of the "forms" newsgroup.)
Thank you in advance for any help you can offer.