PC Review


Reply
Thread Tools Rate Thread

Add entry to drop down list

 
 
=?Utf-8?B?UmlzaWtpbw==?=
Guest
Posts: n/a
 
      19th May 2006
I need to find out how to allow a user to add an item to a drop down list
that does not already exist in the drop down list. I am not sure If i need
to write a macro to do this or if there is a setting that can be used.

For instance. A user is entering data in the database. The come to a field
in the form that has a drop down list of categories including "staff",
"trainees", and "agencies". The information they are entering needs to to go
into the category "vendors". I have the field set to No for limit to list,
but how do I get the data they enter to automatically add to the list?

Thanks.
 
Reply With Quote
 
 
 
 
Pieter Wijnen
Guest
Posts: n/a
 
      19th May 2006
once again www.mps.org/acces

"Risikio" <(E-Mail Removed)> wrote in message
news:FFBE06D5-C8D6-4B91-9C38-(E-Mail Removed)...
>I need to find out how to allow a user to add an item to a drop down list
> that does not already exist in the drop down list. I am not sure If i
> need
> to write a macro to do this or if there is a setting that can be used.
>
> For instance. A user is entering data in the database. The come to a
> field
> in the form that has a drop down list of categories including "staff",
> "trainees", and "agencies". The information they are entering needs to to
> go
> into the category "vendors". I have the field set to No for limit to
> list,
> but how do I get the data they enter to automatically add to the list?
>
> Thanks.



 
Reply With Quote
 
=?Utf-8?B?eFJvYWNoeA==?=
Guest
Posts: n/a
 
      19th May 2006
Hi Risikio -- Below is a sub from one of my DBs that adds an item to the
list. You can substitute you fields, table, etc.

Private Sub cboPaidTo_NotInList(NewData As String, Response As Integer)

Dim db As DAO.Database
Dim YesNo As VbMsgBoxStyle

YesNo = Msgbox("Enter New Value?", vbYesNo + vbQuestion +
vbDefaultButton1, "NEW VALUE")

Select Case YesNo
Case vbYes
Set db = CurrentDb()

DoCmd.OpenForm "frmEditExpenses", acNormal, , , acFormAdd, acDialog

'Add the new value to the field
' db.Execute "INSERT INTO tblPaidToRef (EntityName) " & _
' "VALUES (""" & NewData & """)", dbFailOnError

'Tell Access you've added the value
Response = acDataErrAdded

db.Close
Set db = Nothing

Case vbNo
cboPaidTo.Text = ""
End Select

End Sub

"Risikio" wrote:

> I need to find out how to allow a user to add an item to a drop down list
> that does not already exist in the drop down list. I am not sure If i need
> to write a macro to do this or if there is a setting that can be used.
>
> For instance. A user is entering data in the database. The come to a field
> in the form that has a drop down list of categories including "staff",
> "trainees", and "agencies". The information they are entering needs to to go
> into the category "vendors". I have the field set to No for limit to list,
> but how do I get the data they enter to automatically add to the list?
>
> Thanks.

 
Reply With Quote
 
=?Utf-8?B?UmlzaWtpbw==?=
Guest
Posts: n/a
 
      19th May 2006
I think I found the answer. I had to go into the form to set a On Not in
List [Event Procedure]. I was looking for it in the tables. Does the [Event
Procedure] automatically write the correct code? I am not real good with the
visual basic side of access.

"Risikio" wrote:

> I need to find out how to allow a user to add an item to a drop down list
> that does not already exist in the drop down list. I am not sure If i need
> to write a macro to do this or if there is a setting that can be used.
>
> For instance. A user is entering data in the database. The come to a field
> in the form that has a drop down list of categories including "staff",
> "trainees", and "agencies". The information they are entering needs to to go
> into the category "vendors". I have the field set to No for limit to list,
> but how do I get the data they enter to automatically add to the list?
>
> Thanks.

 
Reply With Quote
 
=?Utf-8?B?UmlzaWtpbw==?=
Guest
Posts: n/a
 
      19th May 2006
Thanks. I will give this a try.

"xRoachx" wrote:

> Hi Risikio -- Below is a sub from one of my DBs that adds an item to the
> list. You can substitute you fields, table, etc.
>
> Private Sub cboPaidTo_NotInList(NewData As String, Response As Integer)
>
> Dim db As DAO.Database
> Dim YesNo As VbMsgBoxStyle
>
> YesNo = Msgbox("Enter New Value?", vbYesNo + vbQuestion +
> vbDefaultButton1, "NEW VALUE")
>
> Select Case YesNo
> Case vbYes
> Set db = CurrentDb()
>
> DoCmd.OpenForm "frmEditExpenses", acNormal, , , acFormAdd, acDialog
>
> 'Add the new value to the field
> ' db.Execute "INSERT INTO tblPaidToRef (EntityName) " & _
> ' "VALUES (""" & NewData & """)", dbFailOnError
>
> 'Tell Access you've added the value
> Response = acDataErrAdded
>
> db.Close
> Set db = Nothing
>
> Case vbNo
> cboPaidTo.Text = ""
> End Select
>
> End Sub
>
> "Risikio" wrote:
>
> > I need to find out how to allow a user to add an item to a drop down list
> > that does not already exist in the drop down list. I am not sure If i need
> > to write a macro to do this or if there is a setting that can be used.
> >
> > For instance. A user is entering data in the database. The come to a field
> > in the form that has a drop down list of categories including "staff",
> > "trainees", and "agencies". The information they are entering needs to to go
> > into the category "vendors". I have the field set to No for limit to list,
> > but how do I get the data they enter to automatically add to the list?
> >
> > Thanks.

 
Reply With Quote
 
=?Utf-8?B?eFJvYWNoeA==?=
Guest
Posts: n/a
 
      19th May 2006
No, you'll need to write the code, which you have in my sub. The
only thing you have to do is substitute the appropriate names. Also, make
sure the SQL execute statement isn't commented out.

"Risikio" wrote:

> I think I found the answer. I had to go into the form to set a On Not in
> List [Event Procedure]. I was looking for it in the tables. Does the [Event
> Procedure] automatically write the correct code? I am not real good with the
> visual basic side of access.
>
> "Risikio" wrote:
>
> > I need to find out how to allow a user to add an item to a drop down list
> > that does not already exist in the drop down list. I am not sure If i need
> > to write a macro to do this or if there is a setting that can be used.
> >
> > For instance. A user is entering data in the database. The come to a field
> > in the form that has a drop down list of categories including "staff",
> > "trainees", and "agencies". The information they are entering needs to to go
> > into the category "vendors". I have the field set to No for limit to list,
> > but how do I get the data they enter to automatically add to the list?
> >
> > Thanks.

 
Reply With Quote
 
=?Utf-8?B?UmlzaWtpbw==?=
Guest
Posts: n/a
 
      19th May 2006
Thanks again. I had posted my finding at the same time your posted your
code. I am working on it now.

Thank you again.

"xRoachx" wrote:

> No, you'll need to write the code, which you have in my sub. The
> only thing you have to do is substitute the appropriate names. Also, make
> sure the SQL execute statement isn't commented out.
>
> "Risikio" wrote:
>
> > I think I found the answer. I had to go into the form to set a On Not in
> > List [Event Procedure]. I was looking for it in the tables. Does the [Event
> > Procedure] automatically write the correct code? I am not real good with the
> > visual basic side of access.
> >
> > "Risikio" wrote:
> >
> > > I need to find out how to allow a user to add an item to a drop down list
> > > that does not already exist in the drop down list. I am not sure If i need
> > > to write a macro to do this or if there is a setting that can be used.
> > >
> > > For instance. A user is entering data in the database. The come to a field
> > > in the form that has a drop down list of categories including "staff",
> > > "trainees", and "agencies". The information they are entering needs to to go
> > > into the category "vendors". I have the field set to No for limit to list,
> > > but how do I get the data they enter to automatically add to the list?
> > >
> > > Thanks.

 
Reply With Quote
 
=?Utf-8?B?eFJvYWNoeA==?=
Guest
Posts: n/a
 
      19th May 2006
Great, let me know if you run into any problems by posting your own code.
Good Luck.

"Risikio" wrote:

> Thanks again. I had posted my finding at the same time your posted your
> code. I am working on it now.
>
> Thank you.
>
> "xRoachx" wrote:
>
> > No, you'll need to write the code, which you have in my sub. The
> > only thing you have to do is substitute the appropriate names. Also, make
> > sure the SQL execute statement isn't commented out.
> >
> > "Risikio" wrote:
> >
> > > I think I found the answer. I had to go into the form to set a On Not in
> > > List [Event Procedure]. I was looking for it in the tables. Does the [Event
> > > Procedure] automatically write the correct code? I am not real good with the
> > > visual basic side of access.
> > >
> > > "Risikio" wrote:
> > >
> > > > I need to find out how to allow a user to add an item to a drop down list
> > > > that does not already exist in the drop down list. I am not sure If i need
> > > > to write a macro to do this or if there is a setting that can be used.
> > > >
> > > > For instance. A user is entering data in the database. The come to a field
> > > > in the form that has a drop down list of categories including "staff",
> > > > "trainees", and "agencies". The information they are entering needs to to go
> > > > into the category "vendors". I have the field set to No for limit to list,
> > > > but how do I get the data they enter to automatically add to the list?
> > > >
> > > > Thanks.

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
LIST ENTRY >> ENABLE DROP DOWN LIST TO ACCEPT MORE THAN 1 ENTRY Frank Microsoft Excel Misc 2 18th Sep 2008 10:31 PM
Combobox List Drop on Entry Daniel A. Microsoft Excel Programming 3 19th Dec 2007 01:35 PM
drop down list shows first blank row after last list entry =?Utf-8?B?SmVycnkgQmVubmV0dA==?= Microsoft Excel Misc 1 10th Nov 2007 11:35 AM
how do I link a drop down list entry to a new drop down cell? =?Utf-8?B?bG11bnplbg==?= Microsoft Excel Misc 1 15th Aug 2006 04:59 PM
Data Entry from a list (drop down box) =?Utf-8?B?RGF2ZQ==?= Microsoft Excel Misc 2 18th Sep 2004 02:34 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:40 PM.