Hi Guys,this is my first time on bytes.I have a fair understanding of Access and can manage to get my way around it, I use macros and occasionally a bit of coding,which is all self tought; however there are times (like now) where I feel that I could do with proffessional advice.I have table tblMembers that,in which member details are captutred,eg Name ,Address,Option.each member has a UniqueID in tblMembers.The members are captured through a form that has a ComboBox with the options. As a memeber can have more than one option;is there a way I can use to populate the options textbox tblMembers with all the selected options at once.For example member 1,may have chosen Options 1,2 4,6 and 7.
any help will be appreciated.Thanks.vusunina
2 1244
One of the cardinal rules of relational database is that you never store more than one piece of data in any field. The proper way to do this would be to have a separate Options table and use it as the basis for a subform. When moving to a member's record on the main form, the subform would display a record for each Option that was selected by the member.
Having said that, here is the way to do what you've requested. Replace
YourOptionsComboBox
with the actual name of your combobox, and
txtOptions
with the actual name of the textbox on your form that holds the options data. - Private Sub YourOptionsComboBox_AfterUpdate()
-
If IsNull(Me.txtOptions) Then
-
Me.txtOptions = Me.YourOptionsComboBox
-
Else
-
Me.txtOptions = Me.txtOptions & ", " & Me.YourOptionsComboBox
-
End If
-
End Sub
Welcome to Bytes!
Linq ;0)>
Assuming you have a 'List' Box named lstOptions with its MultiSelect Property set to Extended, and a Text Box on your Form named txtMemberOptions, the following code will write all the Multiple Items selected in lstOptions to txtMemberOptions in a Comma Delimited Format. - Dim ctl As Control
-
Dim varItm As Variant
-
Dim strOptions As String
-
-
Set ctl = Me![lstOptions]
-
-
If ctl.ItemsSelected.Count > 0 Then
-
For Each varItm In ctl.ItemsSelected
-
strOptions = strOptions & "," & ctl.ItemData(varItm)
-
Next varItm
-
Me![txtMemberOptions] = Mid$(strOptions, 2)
-
End If
OUTPUT: -
'Assuming the User selects Option 1, Option 3, Option 6, Option 8, and Option 9
-
Option 1,Option 3,Option 6,Option 8,Option 9
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Drew |
last post by:
I have a db table like the following,
UID, int auto-increment
RegNo
Person
Relation
YearsKnown
Now here is some sample data from this table,
|
by: ar |
last post by:
If I had a form with one textbox on it and I wanted to populate that textbox
on page load, how could I do that from a global procedure?
I tried creating a separate class file with the following...
|
by: sck10 |
last post by:
Hello,
I am creating a form for users to enter information about a lab and the
members of the lab. I have one form (FormView) that they use to enter
information about that lab. The keyvalue is...
|
by: TB |
last post by:
Hi All:
I have this page where a rows / cells are programmatically added to to
table by pushing a button.
The rows contain a textbox and a associated button. What I want to is
to be able to...
|
by: Erland |
last post by:
Hello all,
I have just installed visual studio .net 2005 and started developing
programs in asp.net 2.0. I have a scenerio where I have to populate
treeview child nodes based on the entries...
|
by: CCLeasing |
last post by:
Hello, I have searched google but can not find a straight forward
answer to my problem. Hopefuly someone will be kind enough to offer
their expertise. Please forgive if this seems a bit convoluted...
|
by: CCLeasing |
last post by:
Hello, I have searched google but can not find a straight forward
answer to my problem. Hopefuly someone will be kind enough to offer
their expertise. Please forgive if this seems a bit convoluted...
|
by: jvb |
last post by:
Hey all, quick question
I have a form with 6 tabs on it. On each tab there is a textbox which
is bound to a specific column in a dataset. When I load the form, I
bind all the controls, however,...
|
by: Bomac8 |
last post by:
I have a text file with "|" as a delimeter with three (3) fields
XXX-12345|\\YYYYYYY|\\ZZZZZZZZ
I need to read these files into an output folder. The problem that I'm having is that I need to...
|
by: JonWB |
last post by:
Hi,
I am very new to .Net and have recently taken over someone else’s project. I am developing an asp webpage using C#.
I have an asp:table that is populated using data from a database....
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
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,...
|
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,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |