If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Cascading Combo box Code
I posed the question about tutorials for creating a cascading combo box. I
was directed to a site and now understand the process. Created a table with the fields suggested from the tutorial.The code is as follows. Private Sub cboCountry_AfterUpdate() On Error Resume Next ' Synchronise country combo with existing city cboCountry = DLookup("[Country]", "tblAll", "[City]='" & cboCity.Value & "'") ' Synchronise city combo with existing city cboCity.RowSource = "Select tblAll.City " & _ "FROM tblAll " & _ "WHERE tblAll.Country = '" & cboCountry.Value & "' " & _ "ORDER BY tblAll.City;" End Sub I need to not have duplicated city's come up per the county. Is there some code within the present code to make all the selections of the city's unique. Thank you in advance. |
#2
|
|||
|
|||
Cascading Combo box Code
Add a DISTINCT to the RowSource:
cboCity.RowSource = "Select DISTINCT tblAll.City ... -- Allen Browne - Microsoft MVP. Perth, Western Australia. Tips for Access users - http://allenbrowne.com/tips.html Reply to group, rather than allenbrowne at mvps dot org. "Mike Busch" wrote in message ... I posed the question about tutorials for creating a cascading combo box. I was directed to a site and now understand the process. Created a table with the fields suggested from the tutorial.The code is as follows. Private Sub cboCountry_AfterUpdate() On Error Resume Next ' Synchronise country combo with existing city cboCountry = DLookup("[Country]", "tblAll", "[City]='" & cboCity.Value & "'") ' Synchronise city combo with existing city cboCity.RowSource = "Select tblAll.City " & _ "FROM tblAll " & _ "WHERE tblAll.Country = '" & cboCountry.Value & "' " & _ "ORDER BY tblAll.City;" End Sub I need to not have duplicated city's come up per the county. Is there some code within the present code to make all the selections of the city's unique. Thank you in advance. |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Unable to send emails to myself and email addresses with same domain name? | andy | General Discussion | 7 | October 5th, 2005 07:24 PM |
error 550 won't deliver | theMooooo | General Discussion | 3 | March 29th, 2005 12:47 PM |
0x80040109 error when sending from SSL SMTP | krouse | General Discussion | 7 | March 15th, 2005 01:55 AM |
SMTP Authentication fails | SharpEye | General Discussion | 0 | February 25th, 2005 08:49 AM |
Outlook XP email goes to sent folder -receipient doesn't receive,. | Jobde | General Discussion | 3 | February 9th, 2005 04:29 PM |