too easy to be found in the help file

ed0

New Member
Joined
Jun 1, 2004
Messages
6
Hi everyone, thanks for viewing my post

i'm having my first access experiment today,and i am having troubles.
I have a form with a dropdown of model numbers which i have defined, and it works fine, but i want the end user to be able to add a model number in the form view, and have that new model number appear on the drop down list.

I've been reading about combo boxes for the last hour and am getting nowhere.

your help is much appreciated
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
Check out the NotInList event of the combobox.

When a user enters a value that isn't in the list and if the LimitToList property is set to Yes this event will be triggered.

You could then write code to add the new value.

eg

Code:
Private Sub Insurer_NotInList(NewData As String, Response As Integer)
    Response = acDataErrAdded
    AddNewInsurer NewData
End Sub
Function AddNewInsurer(NewIns As String)
' adds new insurer to insurers tabls
Dim db As Database, rst As Recordset
Set db = CurrentDb

Set rst = db.OpenRecordset("Insurers")
    With rst
        rst.AddNew
        !Insurer = NewIns
        .Update
        rst.Close
    End With
End Function

This is a bit of old code that I used to add new insurers to a table.
 
Upvote 0

Forum statistics

Threads
1,221,783
Messages
6,161,938
Members
451,730
Latest member
BudgetGirl

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top