Need help in NotInList event

S

Song Su

Access 2007

After confirm OK to add new data, it still prompt me "The text you entered
isn't an item in the list" with OK. Click again, it goes back to my combo
and newly added data is not in combo. Then I opened the table, the newly
added record has been added in the table. What's wrong with my NotInList
event? my PONumber is text field primary key. Here is the code:

Private Sub cboPO_NotInList(NewData As String, Response As Integer)
Dim strSQL As String
Dim i As Integer
Dim Msg As String

'Exit this sub if the combo box is cleared
If NewData = "" Then Exit Sub
Msg = "Add new PO?"
i = MsgBox(Msg, vbQuestion + vbYesNo, "Unknown PO")
If i = vbYes Then
strSQL = "Insert Into POs ([PONumber]) " & _
"values ('" & NewData & "');"
CurrentDb.Execute strSQL, dbFailOnError
Response = acDataErrAdded
Else
Response = acDataErrContinue
End If
End Sub
 
M

Mark A. Sam

Dear Song Su,

Whenever something doesn't work in A2007, I try the same thing in A2002.
Many times it works and I know that A2007 is the problem and not the method.
If you can I would try using the earlier version if you are able and can
connert the database.

God Bless,

Mark A. Sam
 
S

Song Su

Do you mean Access 2007 cannot do NotInList event?
Does Microsoft know this?
Is there a way to get around it?

I dont' have previouse version and thus cannot try these code out.

Mark A. Sam said:
Dear Song Su,

Whenever something doesn't work in A2007, I try the same thing in A2002.
Many times it works and I know that A2007 is the problem and not the
method. If you can I would try using the earlier version if you are able
and can connert the database.

God Bless,

Mark A. Sam



Song Su said:
Access 2007

After confirm OK to add new data, it still prompt me "The text you
entered isn't an item in the list" with OK. Click again, it goes back to
my combo and newly added data is not in combo. Then I opened the table,
the newly added record has been added in the table. What's wrong with my
NotInList event? my PONumber is text field primary key. Here is the code:

Private Sub cboPO_NotInList(NewData As String, Response As Integer)
Dim strSQL As String
Dim i As Integer
Dim Msg As String

'Exit this sub if the combo box is cleared
If NewData = "" Then Exit Sub
Msg = "Add new PO?"
i = MsgBox(Msg, vbQuestion + vbYesNo, "Unknown PO")
If i = vbYes Then
strSQL = "Insert Into POs ([PONumber]) " & _
"values ('" & NewData & "');"
CurrentDb.Execute strSQL, dbFailOnError
Response = acDataErrAdded
Else
Response = acDataErrContinue
End If
End Sub
 
M

Mark A. Sam

No, I mean that some methods that work in earlier versions ar problematic in
Access2007. Actually, A2007 is inconsistent between systems. Sometimes
something will work on one system and not another. If you haven't, try
updating Office. A lot of my problems disappeared when I did.


Song Su said:
Do you mean Access 2007 cannot do NotInList event?
Does Microsoft know this?
Is there a way to get around it?

I dont' have previouse version and thus cannot try these code out.

Mark A. Sam said:
Dear Song Su,

Whenever something doesn't work in A2007, I try the same thing in A2002.
Many times it works and I know that A2007 is the problem and not the
method. If you can I would try using the earlier version if you are able
and can connert the database.

God Bless,

Mark A. Sam



Song Su said:
Access 2007

After confirm OK to add new data, it still prompt me "The text you
entered isn't an item in the list" with OK. Click again, it goes back to
my combo and newly added data is not in combo. Then I opened the table,
the newly added record has been added in the table. What's wrong with my
NotInList event? my PONumber is text field primary key. Here is the
code:

Private Sub cboPO_NotInList(NewData As String, Response As Integer)
Dim strSQL As String
Dim i As Integer
Dim Msg As String

'Exit this sub if the combo box is cleared
If NewData = "" Then Exit Sub
Msg = "Add new PO?"
i = MsgBox(Msg, vbQuestion + vbYesNo, "Unknown PO")
If i = vbYes Then
strSQL = "Insert Into POs ([PONumber]) " & _
"values ('" & NewData & "');"
CurrentDb.Execute strSQL, dbFailOnError
Response = acDataErrAdded
Else
Response = acDataErrContinue
End If
End Sub
 
S

Song Su

I went to Microsoft office update site, it guided me for Windows update. My
Windows (VISTA) is already uptodate. what's my option?

Mark A. Sam said:
No, I mean that some methods that work in earlier versions ar problematic
in Access2007. Actually, A2007 is inconsistent between systems.
Sometimes something will work on one system and not another. If you
haven't, try updating Office. A lot of my problems disappeared when I
did.


Song Su said:
Do you mean Access 2007 cannot do NotInList event?
Does Microsoft know this?
Is there a way to get around it?

I dont' have previouse version and thus cannot try these code out.

Mark A. Sam said:
Dear Song Su,

Whenever something doesn't work in A2007, I try the same thing in A2002.
Many times it works and I know that A2007 is the problem and not the
method. If you can I would try using the earlier version if you are able
and can connert the database.

God Bless,

Mark A. Sam



Access 2007

After confirm OK to add new data, it still prompt me "The text you
entered isn't an item in the list" with OK. Click again, it goes back
to my combo and newly added data is not in combo. Then I opened the
table, the newly added record has been added in the table. What's wrong
with my NotInList event? my PONumber is text field primary key. Here is
the code:

Private Sub cboPO_NotInList(NewData As String, Response As Integer)
Dim strSQL As String
Dim i As Integer
Dim Msg As String

'Exit this sub if the combo box is cleared
If NewData = "" Then Exit Sub
Msg = "Add new PO?"
i = MsgBox(Msg, vbQuestion + vbYesNo, "Unknown PO")
If i = vbYes Then
strSQL = "Insert Into POs ([PONumber]) " & _
"values ('" & NewData & "');"
CurrentDb.Execute strSQL, dbFailOnError
Response = acDataErrAdded
Else
Response = acDataErrContinue
End If
End Sub
 
M

Mark A. Sam

Song Su said:
I went to Microsoft office update site, it guided me for Windows update. My
Windows (VISTA) is already uptodate. what's my option?

Buy a Mac ;)

I don't know how to guide you here. When I updated over a year ago, there
was a link somewhere, and I think it was a menu item in Access2007. I can't
find it now. It looks like all that is available is a Windows update.
 

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