Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

drop down list in Form

Status
Not open for further replies.

ashaikh05

MIS
Mar 2, 2007
13
GB
Hello

Basically i've got a form with combo boxes and free text fields. Once the data is entered it is saved into a separate (Main) table.

My question is there is one combo box on there that i'd like to be able to add values to that combo box but at the same be able to submit the value to the main table?
 
the combo box you want to add stuff to..where does the data initially come from ?

A table...

Add the record to the table then call the ComboBox's Requery function.

A list...

Update the combobox by adding the new entry to the end of RecordSource

Hope this helps!

Regards

BuilderSpec
 
Currently its getting it from a table.

So what is the best way of adding the data of the current record into the (Main) table and at the same time updating the table that the combo box looks up?

Sorry but I am a beginner with forms and access
 
Adding a record to the table

dim SQL as string
SQL = "INSERT INTO Table ( Field1,Field2 ) VALUES 'value1','value2';"
DoCmd.RunSQL SQL

This should add the record to the field. Obviously substitute field names and values etc..

Then call the combo box's Requery method.

I would add the code in the form's "AfterInsert" event.

Hope this helps!

Regards

BuilderSpec
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top