Row source & control source on a form; PLEASE help if you can...

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello

Apologies in advance if this is a silly question???!!!
I have created a form in Access 2002, and one of the fields in my form is a
combo box which the users will select a value from. The combo box has a
table as the row source, which I will call tblLookup. If the users cannot
find a value specific to their requirements, they can type in their own
value. I am trying to find a way to be able to add any new values typed by
users in the table (tblLookup). So basically, if the users cannot find a
value in the combo box, they type a new value and this new value will save in
the table.

Hope this makes sense
Any help/ideas/suggestions would be greatly appreciated
Thanking you in advance...

AC
 
You can set the limit to yes for the combo box.

For the not in list event, you can use the following code:

Dim strSql As String
If MsgBox(NewData & " not in list, add?", _
vbYesNo + vbQuestion) = vbYes Then
strSql = "insert into tblStudents (name) values('" & NewData & "')"
CurrentDb.Execute strSql
Response = acDataErrAdded
End If

Note I used a table name of tblStudents, and field name of Sname. So, just
change the table name, and the field to whatever you used.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top