473,322 Members | 1,496 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Copying values from a List Box into a Text Box

Hello,
I am creating a database in Microsoft Access 2000. It's to store books and other resources, like a library database (just to give you a bit of a background). I have a field called "Subject". It's a text field. In there, you manually type in the subject(s) that that book relates to, for example Sports, Health, Sex Education, Careers, Citizenship, etc. However, it's a bit inefficient to have to manually type in these words.

However, I would like to arrange this so the subjects don't have to be typed in. I would like to have a list box on the form with all the subjects listed in it. Then when you click a subject in the list box, it will copy it into the 'subject' field. More than one subject needs to be selectable, sor example you may have a book that relates to... sex education and health and wellbeing, so I may want all three subjects to be copied into the subject field.

I want to keep the subject field as a text box, I only want the words from the list box copied and pasted into the subject field (preferably seperated by commas). (i.e. If I select Health and Drugs in the List Box I want to create, I want "Health, Drugs" to appear in the existing 'Subject' text box.

Hope somebody can help. If somebody does reply, please can you talk nice and s-l-o-w-l-y for me, I have a stinking cold and through my eyes watering I can barely see my monitor, let alone comprehend anything remotely complex! The answer may be simple, I have a feeling I may have some something simmilar in college before. But I can't find anything and I've searched the net and can't find an answer. I'd very much appreciate any help anybody can give.

Thanks, Robert.
Mar 10 '08 #1
1 6324
I'm actually replying to my own question, I found an old database with what I needed in it. I thought I'd put the answer on here just incase anybody else was searching for it.

I put the following code into the on click procedure for the list box:
Expand|Select|Wrap|Line Numbers
  1. If Len(Nz(Me!Subject.Value)) > 0 Then
  2.     Me!Subject.Value = Me!Subject.Value & ", " & Me!List13.Value
  3. Else
  4.     Me!Subject.Value = Me!List13.Value
  5. End If
  6.  
This code copies the value selected in the list box into the text box, and if more than one is selected, they are seperated by commas.
Mar 15 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

23
by: Francis Avila | last post by:
Below is an implementation a 'flattening' recursive generator (take a nested iterator and remove all its nesting). Is this possibly general and useful enough to be included in itertools? (I know...
1
by: Filips Benoit | last post by:
Dear All, After copying a record using an Stored procedure all textfields (nvarchar) has max lenght ! See VBA-code and SP below VBA-code tos execute SP
21
by: Matteo Settenvini | last post by:
Ok, I'm quite a newbie, so this question may appear silly. I'm using g++ 3.3.x. I had been taught that an array isn't a lot different from a pointer (in fact you can use the pointer arithmetics to...
5
by: Lyn | last post by:
I am trying to copy selected fields from one table to another, by reading the source table record into a recordset (ADO) and then copying the relevant fields to an SQL statement "INSERT INTO...". ...
0
by: San Diego Guy | last post by:
Hi all! I have Datagrid. Within that datagrid I have a drop down list that I set up some values in (a "collection") I set up an edit command column on the datagrid and wrote simple code to get...
10
by: Martin Ho | last post by:
I am running into one really big problem. I wrote a script in vb.net to make a copy of folders and subfolder to another destination: - in 'from.txt' I specify which folders to copy - in...
3
by: John | last post by:
Hi all, My application updates a sql server 2005 express database prior to copying it with the result being the "in use by another process" and I cannot copy it as a result. I've posted the code...
8
by: zefciu | last post by:
Hello! Where can I find a good explanation when does an interpreter copy the value, and when does it create the reference. I thought I understand it, but I have just typed in following...
1
by: Intrepid_Yellow | last post by:
Hi, I have the following code that runs my report generator. The user selects a table from a combo box, then whatever fields they want from a list box. (This part all works and the report runs...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.