A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Cascading Combo box Code



 
 
Thread Tools Display Modes
  #1  
Old December 8th, 2005, 12:15 AM posted to microsoft.public.access.forms
external usenet poster
 
Posts: n/a
Default 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  
Old December 8th, 2005, 03:33 AM posted to microsoft.public.access.forms
external usenet poster
 
Posts: n/a
Default 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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

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


All times are GMT +1. The time now is 01:24 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.