🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.databases.ms-access
Article #256

Re: How one combo box changes the contents of another i Access 97?

#256
From: James Long
Date: Wed, 29 Oct 1997 00:00
37 lines
2112 bytes
Martin, the way I do this is as follows:

Private Sub State_AfterUpdate()
 Dim dbs As Database, qdf As QueryDef, strSQL As String
Set dbs = CurrentDb
strSQL = "SELECT counties.NAME FROM counties GROUP BY counties.STATE_NAME, _
     counties.NAME HAVING (((counties.STATE_NAME) = '" &
Forms!Insurance!state & "')) _
    ORDER BY counties.NAME;"
Forms!Insurance!County.RowSource = strSQL
End Sub

I have two combo boxes "state" and "counties." The above code executes after
the state box is changed. It runs a SQL query (stSQL) which returns a list
of counties in that state. This query value is used as the imput for the
county Row Source.

I hope this helps,

James Long


Martin Madsen wrote in message <01bce389$2d351710$1ec0e482@ns>...
>Does anyone know how to change the contents of a combo box. For instance if
>your choose Denmark i combo bok no. 1, you would get all the danish cities
>in combo box no. 2.
>
>Is it also possible in case of Not in List, to add a new item with
>confirmation to this combo box.
>
>If you have any exampels, please attach.
>
>Thanks in advance
>
>Martin Oliver Madsen
>-Denmark
Technical Details
Message-ID: <637nes$lif$1@service3.uky.edu>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <01bce389$2d351710$1ec0e482@ns>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 101bdd,ee3c498573f2d6e3
X-Google-Attributes: gid101bdd,public
X-Google-Thread: 10779a,ee3c498573f2d6e3
X-Google-Attributes: gid10779a,public
X-Google-Thread: fa6f6,ee3c498573f2d6e3
X-Google-Attributes: gidfa6f6,public
X-Google-Thread: 1163bd,ee3c498573f2d6e3
X-Google-Attributes: gid1163bd,public
X-Google-Thread: ff0ac,ee3c498573f2d6e3
X-Google-Attributes: gidff0ac,public
From: "James Long" <jdlong00@pop.uky.edu>
Subject: Re: How one combo box changes the contents of another i Access 97?
Date: 1997/10/29
Message-ID: <637nes$lif$1@service3.uky.edu>
X-Deja-AN: 285791885
References: <01bce389$2d351710$1ec0e482@ns>
X-MimeOLE: Produced By Microsoft MimeOLE V4.71.1712.3
Organization: University of Kentucky Computing Services
Newsgroups: comp.databases.ms-access,dk.edb.programmering,microsoft.public.access,microsoft.public.access.forms,microsoft.public.access.formsprogramming