updating a table from a form....

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

softspoken

Thread Starter
Joined
Mar 22, 2010
Messages
55
I created a database, split the database, put the front end on multiple users pc's, and now I have an issue.

The issue is : I have a few fields that are drop down boxes so that they can pick something from the list. There will be times when they will have to key in something because it was not in the drop down box.

Is there a way to add what was keyed in the form manually , automatically to the table that houses the drop down information?

I hope that is clear enough....

(Access 2003)
 

OBP

Joined
Mar 8, 2005
Messages
19,895
What type of entry do you need to make? If you need to enter more than one field then a Form needs to be opened and the entries made.
If it is just one field then it can be handled using the Combo box's "On Not in List" property along with the setting the "Limit to List" property to "Yes".
 

softspoken

Thread Starter
Joined
Mar 22, 2010
Messages
55
Its just one field so the Combo box's "On not in List" would be fine. Can you assist me on how to set that up.

The table that is assigned to the combo box is called "Summary of App Err". Thank you
 

OBP

Joined
Mar 8, 2005
Messages
19,895
In the combo properties change the "Limit to List" property to "Yes".
In the combo properties "On Not in List" event procedure click on it and select "Event Procedure" and click the 3 small dots to open the VBA Editor and then Paste this in

Dim rst As Object, txtName As String

On Error GoTo errorcatch

txtName = MsgBox("Add '" & NewData & "' to the list of Clients?", _
vbQuestion + vbYesNo)
If txtName = vbYes Then
' Add data stored in NewData argument to the Summary of App Err table.
Set rst = CurrentDb.OpenRecordset("Summary of App Err")
rst.AddNew
rst!FieldName = NewData
rst.Update
Response = acDataErrAdded ' Requery the combo box list.
Else
Response = acDataErrDisplay ' Require the user to select
End If
rst.Close
Set rst = Nothing
Exit Sub
errorcatch:
MsgBox Err.Description

The line of code starting rst!FieldName, the Fieldname needs ot be changed to the name of the field that will hold the new data in the Table.
 

softspoken

Thread Starter
Joined
Mar 22, 2010
Messages
55
That worked perfectly. Thank you so much for all your help. You have been very helpful from day one and its much appreciated.
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 807,865 other people just like you!

Latest posts

Staff online

Top