How can I add an extra name to a drop down list ?

R

Roger

We are using Access2003 on WinXP. We have a database in which there is a
form for entering client data into a client data table. The client name
comes from a client name table and is selected via a drop down list in the
client data form. This is good for 90% of clients who are repeat clients.
10% are new clients, so each time we have a new client I have to add the
client name to the client name table, then go back to the form to enter data
into the client data table. Is there any smart way I can add a new client
name into the client name table and to the drop down list without leaving
the client data form.

thanks ... Roger
 
J

John W. Vinson

We are using Access2003 on WinXP. We have a database in which there is a
form for entering client data into a client data table. The client name
comes from a client name table and is selected via a drop down list in the
client data form. This is good for 90% of clients who are repeat clients.
10% are new clients, so each time we have a new client I have to add the
client name to the client name table, then go back to the form to enter data
into the client data table. Is there any smart way I can add a new client
name into the client name table and to the drop down list without leaving
the client data form.

thanks ... Roger

http://www.mvps.org/access/forms/frm0015.htm
 
R

Roger

Thanks for reply, yes there are always different ways to doing things ... I
guess it's pretty much a learning curve. I have found some code which is
basically what I want to do, but not exactly. I have written the following
which works, but has a couple of problems

#1 the procedure for the response when trying to add a name not in the NAME
field combo list in the AddDATA form is .......



Private Sub NAME_NotInList(NewData As String, Response As Integer)

If MsgBox("This is not in the list ! Do you want to add this NAME to the
list?", _

vbYesNo) Then

DoCmd.OpenForm "AddNAME", , , , acFormAdd, acDialog, NewData

Response = acDataErrAdded

Else

Response = acDataErrContinue

End If



End Sub



#2 in the form to add the new name (form AddNAME) I have the following in
the ON LOAD procedure



Private Sub Form_Load()

If IsNull(Me.OpenArgs) = False Then



Me.NAME = Me.OpenArgs



End If



End Sub



I have 2 problems, first if I click on "NO" in NAME_NotInList, it responds
the same as a yes ! Secondly, the procedure in Form_Load to add the name
works fine, but how do I close the AddNAME form and return to the AddDATA
form automatically after the new NAME has been added ?



Thanks for your help .. Roger
 

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

Top