Re: Form/Subform
- From: Tom van Stiphout <no.spam.tom7744@xxxxxxx>
- Date: Sun, 02 Mar 2008 17:54:27 -0700
On Sun, 2 Mar 2008 13:45:50 +0900, "Allen Browne"
<AllenBrowne@xxxxxxxxxxxxxx> wrote:
I tested this:
Private Sub Fullname_NotInList(NewData As String, Response As Integer)
Dim sql As String
Dim strNames() As String
strNames = Split(NewData, ",")
sql = "insert into Employees ([Last Name],[First Name]) values ('"
& Trim$(strNames(0)) & "','" & Trim$(strNames(1)) & "')"
DoCmd.RunSQL sql, False
Response = acDataErrAdded
End Sub
Note: I wrote the in-line sql for brevity; normally I would us a
parameterized append query. Also a "Are you sure you want to add..."
messagebox would be appropriate.
-Tom.
"Tom van Stiphout" <no.spam.tom7744@xxxxxxx> wrote in message.
news:0qaks398r1h9vvf9uqt9j65q7b07p5sm74@xxxxxxxxxx
On Sun, 2 Mar 2008 13:11:56 +0900, "Allen Browne"
<AllenBrowne@xxxxxxxxxxxxxx> wrote:
Presumably records are added using dropdowns.
You can add new records if you implement the NotInList event.
-Tom.
Hi Tom. Do you have suggestions on how to use NotInList for the case the OP
has in mind?
For example, the Club form has a subform for the persons associated with the
club. Say the subform contains a PersonID combo, with a RowSource of:
SELECT PersonID, Surname & ", " & FirstName AS FullName
FROM tblPerson
ORDER BY Surname, FirstName;
with the first column zero-width.
User types in:
Smith, Fred
which is not in the Person table yet.
Can you use the NotInList to add this to the Person table?
(To the original poster: If you are using Access 2007, you could use the
combo's ListItemsEditForm property.)
- Follow-Ups:
- Re: Form/Subform
- From: Allen Browne
- Re: Form/Subform
- References:
- Form/Subform
- From: Vaudousi
- Re: Form/Subform
- From: Allen Browne
- Re: Form/Subform
- From: Tom van Stiphout
- Re: Form/Subform
- From: Allen Browne
- Form/Subform
- Prev by Date: Control Scrolling Of Continuous Form
- Next by Date: Re: Convert an Access2002 database to Access2007
- Previous by thread: Re: Form/Subform
- Next by thread: Re: Form/Subform
- Index(es):
Relevant Pages
|