473,725 Members | 1,980 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Clear 2nd Combo on form (MS Access 2003)

Hi,

I have a form with 2 combo boxes.
I am not using them in the usual way, please read on:

In the 'Form Load' event, I have:

_______________ _______________ _________

dim folderspec as string
folderspec = "\\server\Image s" (These folders are on our network
server in the office).
Dim fs, f, f1, fc, s
Set fs = CreateObject("S cripting.FileSy stemObject")
Set f = fs.GetFolder(fo lderspec)
Set fc = f.SubFolders
For Each f1 In fc
Me.Combo1.AddIt em f1.name
Next
_______________ _______________ __________
This lists all the sub-folder names within the main folder 'Images'
.....great so far. I then select a specific folder name from Combo1.

In Combo1 'After Update' I have this code:

_______________ _______________ ___________

All the following variables are public.
'folder' is a public varable which holds the selected folder name from
combo1.

folder = ""
FileScript = ""
FolderPath = ""
FileSet = ""

folder = Me.Combo11.Colu mn(0)

Dim strFiles As String
Set FileScript = CreateObject("S cripting.FileSy stemObject")
Set FolderPath = FileScript.GetF older("\\server \Images\" & folder)
Set FileSet = FolderPath.File s

For Each FileSelection In FileSet
Me.Combo2.AddIt em FileSelection.n ame
Next

_______________ _______________ _______________ _______________ _

This works great the first time I select a folder from combo1, combo2
lists all the files within it, but the next time I se;ect another
folder from combo1, all those files are added to combo2 in addition to
the previous files instead of just changing them to the new files ? How
can I clear Combo2 for the next time I select from combo1 ?

I've tried n umerous things such as:

me.combo2 = null
me.combo2.text = ""

none of them seem to make any difference ? Combo2 always gets loaded
with more and more file names...I can understand why this happens, I
just cannot seem to clear combo2 ?

Thanks
David Gordon

Nov 13 '05 #1
1 1662
da*********@sce ne-double.co.uk wrote:
Hi,

I have a form with 2 combo boxes.
I am not using them in the usual way, please read on:

In the 'Form Load' event, I have:

_______________ _______________ _________

dim folderspec as string
folderspec = "\\server\Image s" (These folders are on our network
server in the office).
Dim fs, f, f1, fc, s
Set fs = CreateObject("S cripting.FileSy stemObject")
Set f = fs.GetFolder(fo lderspec)
Set fc = f.SubFolders
For Each f1 In fc
Me.Combo1.AddIt em f1.name
Next
_______________ _______________ __________
This lists all the sub-folder names within the main folder 'Images'
....great so far. I then select a specific folder name from Combo1.

In Combo1 'After Update' I have this code:

_______________ _______________ ___________

All the following variables are public.
'folder' is a public varable which holds the selected folder name from
combo1.

folder = ""
FileScript = ""
FolderPath = ""
FileSet = ""

folder = Me.Combo11.Colu mn(0)

Dim strFiles As String
Set FileScript = CreateObject("S cripting.FileSy stemObject")
Set FolderPath = FileScript.GetF older("\\server \Images\" & folder)
Set FileSet = FolderPath.File s

For Each FileSelection In FileSet
Me.Combo2.AddIt em FileSelection.n ame
Next

_______________ _______________ _______________ _______________ _

This works great the first time I select a folder from combo1, combo2
lists all the files within it, but the next time I se;ect another
folder from combo1, all those files are added to combo2 in addition to
the previous files instead of just changing them to the new files ? How
can I clear Combo2 for the next time I select from combo1 ?

I've tried n umerous things such as:

me.combo2 = null
me.combo2.text = ""

none of them seem to make any difference ? Combo2 always gets loaded
with more and more file names...I can understand why this happens, I
just cannot seem to clear combo2 ?

Thanks
David Gordon

Can you use RemoveItem or Clear prior to adding the items?

Nov 13 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1512
by: peterleeds | last post by:
Could anyone explain why Access 2003 is continuously calculating a continuous form, when it works perfectly in previous versions? On reading previous messages I gather that overlapping controls cause this, but why? I use a hidden control underneath the whole line to highlight it when selected. If I cannot do this in Access 2003, how does one go about getting the
1
2694
by: Frank.Sebesta | last post by:
I have a employees database with a picture that shows on a form with employee information. Similar to the Northwinds sample database. When I print the record, my output is only the data and does not include the picture. My pictures reside on my C drive. How can I get the picture to print with the record or I would be happy to just print the picture seperately?
2
2337
by: carmela_wong | last post by:
Hi all, I have converted a database from Access 2003 to Access 97. Everything gets neatly imported into the new database except for one form which continues to show a fatal error when I try to open it in the new 97 database: "Microsoft Access has encountered a problem and needs to close. We are sorry for the inconvenience. If you were in the middle of something, the information you were
3
2457
by: erainc | last post by:
Hi There, I am trying to put a search box on my form in Access 2003. I tried doing it through a combo box, and the search part works, but the rest of the information on the form does not correlate to the newly searched critieria. Does anyone know how to link all of the information together???? Also, my control wizzard has disappeared, is there anyway to get that back??... For example, if I want to put a combo box into my form it...
2
2913
by: Horst JENS | last post by:
Hi group, have problems with combobox-control in a form (access 2003). I added VBA-Code to on-Change event of the control. If the user choose an value from the control, the filter of the form change to that value. so far it works. problem is, it only works if the user change the (value of the) control with the mouse. As soon as he starts pressing the keyboard, i get errors.
1
2206
by: Bface | last post by:
Hi All, I am stuck on a problem and hope someone can help me out. I have 8 users who will be using a form . For the users to access their accounts I use the SendKeys function, the user click on their name to access their records. Each user has over 300 accounts and it is a growing list. On my main form whose record source is a query based on , I have a button on the main form which open a pop up form , the source for this form is a query...
1
1459
by: sierra7 | last post by:
Hi all One of my users is complaining that when she types in a combo box, instead of matching characters and over-typing, she seems to be inserting e.g. On entering the combo she types her first character "a" and the box then displays the first matching item in normal way ="Aluminium Bronze". The RowSource is based on a query. However, she wants to enter "Aluminium Profiles", so as she is a very fast 'typer' she rapidly types "Aluminium...
6
4938
by: kfanarmy | last post by:
Hello; I am attempting to use a command button "Delete Current Assignment Record" on a form to delete a user-selected record from a table entitled "Registration" with Key field "Registration ID". I am using a combo box named "Select Task" that displays info from three tables to enable the user to select a record. The form's data source is the table Registration. column 7 within the combo box = the Registration ID. the on click event for...
11
2145
by: eyalco | last post by:
I have a receipt form (with continuous sub-form) where I need to issue many receipts in 1 form (from 12 to 36). I need to duplicate the details of each receipt (the only change every time is the date and the cheque number). For the duplication i'm using : Me.dup_field.DefaultValue = """" & Me.dup_field & """" for the cheque number i'm using : Me.CHECK_NO.DefaultValue = """" & Me.CHECK_NO + 1 & """" My problem is the date : each cheque is...
24
3210
greeni91
by: greeni91 | last post by:
I am currently trying to put a find box at the top of a form I have created for reviewing machining methods. I have setup the box to show the Part Number field and take you to that record when selected, but I want to filter the selection of Part Numbers based on certain criteria that I have filled out on various records. I want to know how to word my SQL/Query statement to show only parts that are similar to the one I am viewing at that...
0
8888
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8752
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9401
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9174
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9111
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8096
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4517
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4782
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2634
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.