By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
426,248 Members | 1,979 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 426,248 IT Pros & Developers. It's quick & easy.

Access 97 Combo Box Problem

P: n/a
I have tried to create a combo box that will allow me to enter a company
name at the keyboard and have it saved alphebetically into the combo box's
list. Using the wizard, I have tried the selection which allows me to enter
data rather than using a table or a query. This gets the text entered
alright but it does not save it to the list. Any help appreciated.

Bill.
Nov 12 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
On Wed, 15 Oct 2003 23:42:53 -0700, "William Bradley"
<br******@magma.ca> wrote:

It don't work that way.
When you use that option, behind the scenes you have selected a value
list for the rowsourcetype property. The rowsource contains the data.
In this case probably something like "CompanyOne;CompanyTwo;". You can
check this in the combobox' property window.
This is a highly unusual way of presenting a list of companies. In
most applications, the list would rather come from a table or a query.

Try that first, or explain to us why the valuelist is better in your
situation.

-Tom.
I have tried to create a combo box that will allow me to enter a company
name at the keyboard and have it saved alphebetically into the combo box's
list. Using the wizard, I have tried the selection which allows me to enter
data rather than using a table or a query. This gets the text entered
alright but it does not save it to the list. Any help appreciated.

Bill.


Nov 12 '05 #2

P: n/a

"Tom van Stiphout" <to*****@no.spam.cox.net> wrote in message
news:0c********************************@4ax.com...
On Wed, 15 Oct 2003 23:42:53 -0700, "William Bradley"
<br******@magma.ca> wrote:

It don't work that way.
When you use that option, behind the scenes you have selected a value
list for the rowsourcetype property. The rowsource contains the data.
In this case probably something like "CompanyOne;CompanyTwo;". You can
check this in the combobox' property window.
This is a highly unusual way of presenting a list of companies. In
most applications, the list would rather come from a table or a query.


Thank you Tom. I am presently computerizing our parish records that go back
to 1887. To do this I am using software that uses Access 2000 as its base.

One field is where I enter the ministers name. This is a combo box. When I
enter the ministers name it stays there from record to record until I either
change it or close the programme.

If the minister changes, all I do is type over or delete what was in the
box. This new ministers name will stay there now until I either change it or
close the record, and so on, from minister to minister. However, when I hit
the combo box button, all the ministers names that I have entered are there,
listed alphabetically.

When I close the programme it returns the "minister field" to blank, but
again, if I hit the combo box button all the names I have entered are there.

This is a neat feature, especially when you are doing something similar to
what I am doing now, and would like to be able to repeat it.

Thanks, Bill.
Nov 12 '05 #3

P: n/a
Put this code in the NotInList event of the combo box.

Dim Db As Database, rs As Recordset
Dim strmsg As String
strmsg = "'" & NewData & "' is not in Current List"
strmsg = strmsg & "@You Must Add it to Continue"
strmsg = strmsg & "@Click Yes to link or No to Cancel."
If MsgBox(strmsg, vbQuestion + vbYesNo, "Add new Description?") =
vbNo Then
Response = acDataErrContinue
Else
Set Db = CurrentDb
Set rs = Db.OpenRecordset("tblYourTable", dbOpenDynaset)
On Error Resume Next
rs.AddNew
rs!YourField = NewData
rs.Update
rs.Close

Set rs = Nothing
If Err Then
MsgBox "An error occurred. Please try again."
Response = acDataErrContinue
Else
Response = acDataErrAdded
End If
End If

Make sure that the LimitToList property is set to Yes.

The program will report that the name you have entered is not in the
database and offer to add it for you.

HTH
Patrick

On Wed, 15 Oct 2003 23:42:53 -0700, "William Bradley"
<br******@magma.ca> wrote:
I have tried to create a combo box that will allow me to enter a company
name at the keyboard and have it saved alphebetically into the combo box's
list. Using the wizard, I have tried the selection which allows me to enter
data rather than using a table or a query. This gets the text entered
alright but it does not save it to the list. Any help appreciated.

Bill.


Nov 12 '05 #4

P: n/a
"Patrick" <in**@businessformat.co.uk> wrote in message
news:t2********************************@4ax.com...
Put this code in the NotInList event of the combo box.

Dim Db As Database, rs As Recordset


Thank you Patrick, I will do as you suggest.

Bill.
Nov 12 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.