I've tried all Allans's code and did not work...

  • Thread starter Thread starter Sylvie
  • Start date Start date
S

Sylvie

I have a form with a combo box Row's source criteria:
SELECT Subjects.SubjectID, [FirstName]+" "+[MI]+" "+[LastName] AS Name FROM
Subjects ORDER BY [FirstName]+" "+[MI]+" "+[LastName];
Which when the user did not find name need to add; so I have a command
button that open Subject table. The problem is : IT IS NOT ALLOWING ME TO ADD
NEW SUBJECTS!!!
I tried Allan's code for "Using another event to open a form" and such and
did not work.
Maybe the problem is the combo box. Is there another option? I've been
searching in all thread for weeks and NOTHING. TIA
 
On Thu, 20 Nov 2008 21:25:01 -0800, Sylvie

What version of Access?
Perhaps you accidentally set the AllowEdits or AllowAdditions property
of the form to False.
Can you add records to the table itself?

-Tom.
Microsoft Access MVP
 
I am using Access2003. It is all yes to Allow and no data entry. Any thougths?

Tom van Stiphout said:
On Thu, 20 Nov 2008 21:25:01 -0800, Sylvie

What version of Access?
Perhaps you accidentally set the AllowEdits or AllowAdditions property
of the form to False.
Can you add records to the table itself?

-Tom.
Microsoft Access MVP

I have a form with a combo box Row's source criteria:
SELECT Subjects.SubjectID, [FirstName]+" "+[MI]+" "+[LastName] AS Name FROM
Subjects ORDER BY [FirstName]+" "+[MI]+" "+[LastName];
Which when the user did not find name need to add; so I have a command
button that open Subject table. The problem is : IT IS NOT ALLOWING ME TO ADD
NEW SUBJECTS!!!
I tried Allan's code for "Using another event to open a form" and such and
did not work.
Maybe the problem is the combo box. Is there another option? I've been
searching in all thread for weeks and NOTHING. TIA
 
I am sorry I misspelled Allens's name. I tried t
he codes on his webiste. So I am thinking probably for this version it
doesn't work.
Tom van Stiphout said:
On Thu, 20 Nov 2008 21:25:01 -0800, Sylvie

What version of Access?
Perhaps you accidentally set the AllowEdits or AllowAdditions property
of the form to False.
Can you add records to the table itself?

-Tom.
Microsoft Access MVP

I have a form with a combo box Row's source criteria:
SELECT Subjects.SubjectID, [FirstName]+" "+[MI]+" "+[LastName] AS Name FROM
Subjects ORDER BY [FirstName]+" "+[MI]+" "+[LastName];
Which when the user did not find name need to add; so I have a command
button that open Subject table. The problem is : IT IS NOT ALLOWING ME TO ADD
NEW SUBJECTS!!!
I tried Allan's code for "Using another event to open a form" and such and
did not work.
Maybe the problem is the combo box. Is there another option? I've been
searching in all thread for weeks and NOTHING. TIA
 
I put the code below on the oNot In List, nothing happed, maybe it is
something I am missing:
Private Sub SubjectID_NotInList(NewData As String, Response As Integer)

Dim ctrl As Control
Dim strMessage As String

Set ctrl = Me.ActiveControl
strMessage = "Add " & NewData & " to list?"

If MsgBox(strMessage, vbYesNo + vbQuestion) = vbYes Then
DoCmd.OpenForm "Subjects", _
DataMode:=acFormAdd, _
WindowMode:=acDialog, _
OpenArgs:=NewData
' ensure Subjects closed
DoCmd.Close acForm, "Subjects"
' ensure name has been added
If Not IsNull(DLookup("SubjectID", "FirstName", "LastName", "MI =
""" & _
NewData & """")) Then
Response = acDataErrAdded
Else
strMessage = NewData & " was not added to Subjects table."
MsgBox strMessage, vbInformation, "Warning"
Response = acDataErrContinue
ctrl.Undo
End If
Else
Response = acDataErrContinue
ctrl.Undo
End If

End Sub

Tom van Stiphout said:
On Thu, 20 Nov 2008 21:25:01 -0800, Sylvie

What version of Access?
Perhaps you accidentally set the AllowEdits or AllowAdditions property
of the form to False.
Can you add records to the table itself?

-Tom.
Microsoft Access MVP

I have a form with a combo box Row's source criteria:
SELECT Subjects.SubjectID, [FirstName]+" "+[MI]+" "+[LastName] AS Name FROM
Subjects ORDER BY [FirstName]+" "+[MI]+" "+[LastName];
Which when the user did not find name need to add; so I have a command
button that open Subject table. The problem is : IT IS NOT ALLOWING ME TO ADD
NEW SUBJECTS!!!
I tried Allan's code for "Using another event to open a form" and such and
did not work.
Maybe the problem is the combo box. Is there another option? I've been
searching in all thread for weeks and NOTHING. TIA
 
Back
Top