1772e Access 2003 NotInList Event bug?
Sign Up |  Live StatsLive Stats    Articles 37,322| Comments 177,199| Members 19,408, Newest ssarabjeet61| Online 510
Home Contact
 (Forgotten?): 
    Sikhism
    For best SPN experience, use Firefox Internet Browser!


                                                                   Your Banner Here!    




Click Here to Register/Sign Up Daily Hukamnama Member Blogs Downloads Website Navigation Help Fonts Tags

Access 2003 NotInList Event bug?

Our Donation Goal : Why Donate? : Donate Today! : Donate Anonymously (ਗੁਪਤ) : Our Family of Supporters
Goal this month: 500 USD, Received: 115 USD (23%)
Please Donate...
     
Related Topics...
Thread Thread Starter Forum Replies Last Post
Office 2003,Access 2003 and PMC 2000 ORRIRO Information Technology 1 28-Jul-2006 08:36 AM
Searching an Access 2003 Database Using Data Access Pages Spent Information Technology 6 28-Jul-2006 08:28 AM
HOw do I set up event procedures in MS Access? Donbenz Information Technology 2 28-Jul-2006 08:13 AM
NotinList event Tom Information Technology 5 28-Jul-2006 08:09 AM
Access Event Error 11729 bmoore.personal@gmail.com Information Technology 1 28-Jul-2006 08:00 AM


Tags
2003, access, bug, event, notinlist
Reply Post New Topic In This Forum Stay Connected to Sikhism, Click Here to Register Now!
  #1 (permalink)  
Old 28-Jul-2006, 08:28 AM
pk's Avatar pk
Guest
 
Posts: n/a
   
   
Access 2003 NotInList Event bug?

  Donate Today!   Email to Friend  Tell a Friend   Show Printable Version  Print   Contact sikhphilosophy.net Administraion for any Suggestions, Ideas, Feedback.  Feedback  

Register to Remove Advertisements
Hi,

This is driving me up a wall. I am using the notinlist event for a combo
box, based on a query, 2 columns. The following properties are set:
Bound Column = 1
Column Count = 2
Column Width = 0.0; 1.5
Limit To List = Yes
Auto Expand = Yes

When a value is entered into the combo box I call a rules engine class
module passing the text that was entered. The rules engine assuming the
data passed calls a data engine class module that inserts the new value into
the table. The data engine procedure returns a true false to the rules
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/information-technology/12392-access-2003-notinlist-event-bug.html
engine, that in turn returns a integer that equates to the access constants
used in this event.

I check if the return value equals the constant value of acDataErrAdded and
if it does set the Response argument of the event to the value of
acDataErrAdded.
This all works yet I continue to recieve the message "the item is not in the
list" . The standard access error message is not being suppressed. This
happens even if I run the code directly in the event handler.

Here are the code snippets
Form
Private Sub cboApplications_NotInList(NewData As String, Response As
Integer)
Dim intResponse As Integer
' pass the new app to the rules engine
intResponse =
moRulesEngine.ChangeOptions(DirtyPage:=Me.tabOptio ns.Pages(Index:="pgeProcess"))
If intResponse = acDataErrContinue Then
Response = acDataErrContinue
MsgBox Prompt:="insert of new app name failed"
Else
Response = acDataErrAdded ' value should equate to the constant
acDataErrAdded
End If

Rules Engine Snippet
Case Is = "pgeProcess"
strAppName = DirtyPage.Controls("cboApplications").Text
' pass entered name to rhe routine to check for valid length
blnCheckPassed = ValidateAppName(AppName:=strAppName)
If blnCheckPassed Then ' send the name to the data engine to
insert into the database
blnDataEngineResponse =
moDataEngine.AddListItem(ctl:=DirtyPage.Controls(I ndex:=("cboApplications")),
NewValue:=strAppName)
If blnDataEngineResponse Then
ChangeOptions = acDataErrAdded ' app name was added
successfully
Else
ChangeOptions = acDataErrContinue ' app name was not
added successfully
End If
Else
Err.Raise Number:=mconBASE_ERROR_NBR + 4,
Source:="RulesEngine.ChangeOptions", Description:="The length of the entered
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=12392
text does not fit the column size."
End If
End Select

Data Engine Snippet
Public Function AddListItem(ctl As ComboBox, NewValue As String) As Boolean
Dim strErrorProcedure As String
Dim blnFuncResult As Boolean
On Error GoTo CantAddListItem
strErrorProcedure = "CMPSupport.basDataLayer.AddListItem"
With mocmd
Select Case ctl.Name
Case Is = "cboApplications"
.CommandType = adCmdStoredProc
.CommandText = "spInsertApp"
.Parameters.Append .CreateParameter(Name:="AppDesc",
Type:=adVarChar, Direction:=adParamInput, Size:=50, Value:=NewValue)








Got anything to share on This Topic? Why not share your immediate thoughts/reaction with us! Login Now! or Sign Up Today! to share your views... Gurfateh!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 28-Jul-2006, 08:28 AM
Dirk Goldgar's Avatar Dirk Goldgar
Guest
 
Posts: n/a
   
   
Re: Access 2003 NotInList Event bug?

"pk" wrote in message
news:A6udnTegy6Rp1DjZnZ2dnUVZ_qCdnZ2d@adelphia.com
> Hi,
>
> This is driving me up a wall. I am using the notinlist event for a
> combo box, based on a query, 2 columns. The following properties are
> set:
> Bound Column = 1
> Column Count = 2
> Column Width = 0.0; 1.5
> Limit To List = Yes
> Auto Expand = Yes
>
> When a value is entered into the combo box I call a rules engine class
> module passing the text that was entered. The rules engine assuming
> the data passed calls a data engine class module that inserts the new
> value into the table. The data engine procedure returns a true false
> to the rules engine, that in turn returns a integer that equates to
> the access constants used in this event.
>
> I check if the return value equals the constant value of
> acDataErrAdded and if it does set the Response argument of the event
> to the value of acDataErrAdded.
> This all works yet I continue to recieve the message "the item is not
> in the list" . The standard access error message is not being
> suppressed. This happens even if I run the code directly in the
> event handler.
>
> Here are the code snippets
> Form
> Private Sub cboApplications_NotInList(NewData As String, Response As
> Integer)
> Dim intResponse As Integer
> ' pass the new app to the rules engine
> intResponse =
>

moRulesEngine.ChangeOptions(DirtyPage:=Me.tabOptio ns.Pages(Index:="pgePr
ocess"))
> If intResponse = acDataErrContinue Then
> Response = acDataErrContinue
> MsgBox Prompt:="insert of new app name failed"
> Else
> Response = acDataErrAdded ' value should equate to the
> constant acDataErrAdded
> End If
>
> Rules Engine Snippet
> Case Is = "pgeProcess"
> strAppName = DirtyPage.Controls("cboApplications").Text
> ' pass entered name to rhe routine to check for valid
> length blnCheckPassed =
> ValidateAppName(AppName:=strAppName) If blnCheckPassed
> Then ' send the name to the data engine to
> insert into the database
> blnDataEngineResponse =
>

moDataEngine.AddListItem(ctl:=DirtyPage.Controls(I ndex:=("cboApplication
s")),
> NewValue:=strAppName)
> If blnDataEngineResponse Then
> ChangeOptions = acDataErrAdded ' app name was
> added successfully
> Else
> ChangeOptions = acDataErrContinue ' app name
> was not added successfully
> End If
> Else
> Err.Raise Number:=mconBASE_ERROR_NBR + 4,
> Source:="RulesEngine.ChangeOptions", Description:="The length of the
> entered text does not fit the column size."
> End If
> End Select
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=12392
>
> Data Engine Snippet
> Public Function AddListItem(ctl As ComboBox, NewValue As String) As
> Boolean Dim strErrorProcedure As String
> Dim blnFuncResult As Boolean
> On Error GoTo CantAddListItem
> strErrorProcedure = "CMPSupport.basDataLayer.AddListItem"
> With mocmd
> Select Case ctl.Name
> Case Is = "cboApplications"
> .CommandType = adCmdStoredProc
> .CommandText = "spInsertApp"
> .Parameters.Append
> .CreateParameter(Name:="AppDesc", Type:=adVarChar,
> Direction:=adParamInput, Size:=50, Value:=NewValue)


Assuming the various class do work, and the new item is successfully
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=12392
added to the rowsource table of the combo box, then the only thing that
occurs to me to wonder offhand is whether the data is added via a
separate connection to the database. It looks like this code may be in
an ADP, not an MDB, and I don't know much about them, but in MDBs I've
seen a problem like this where the update procedure uses a separate
connection from the one that Access is using, and Access doesn't know
that the data has been added/updated until some time goes by.

Is data engine module opening a separate connection to the database? If
so, can it use CurrentProject.Connection instead?

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)


Reply With Quote
  #3 (permalink)  
Old 28-Jul-2006, 08:28 AM
Albert D.Kallal's Avatar Albert D.Kallal
Guest
 
Posts: n/a
   
   
Re: Access 2003 NotInList Event bug?

The following works:

You can set the limit to yes = to yes.

The, for the no in list event, you can use the following code:


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

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
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=12392
End If

End Sub

MAKE SURE that the value you are adding is the text field value. The combo
box is storing a ID field, but the NewData is going to be the text value..

When you code runs, does the value get added to the table correctly (simply
open the table....and check what is in the list -- make sure the text bound
column is EXACTLY the same as newdata..or it will fail. In addition, do be
aware of the

I suspect somewhere in your complex code that replaces the above simple code
that you may has messed up the fact that the combo stores a long number id
field, but newdata is text....

--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
pleaseNOOSpamKallal@msn.com
http://www.members.shaw.ca/AlbertKallal
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=12392


Reply With Quote
  #4 (permalink)  
Old 28-Jul-2006, 08:29 AM
pk's Avatar pk
Guest
 
Posts: n/a
   
   
Re: Access 2003 NotInList Event bug?

  Donate Today!  
Albert,

Thanks for the insight. I actually ran something similiar to what you have
written below and still received the same error. The new value does get
added to the table correctly, I thought the event after requerying the combo
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=12392
box does compare the value in the text portion of the control to the list.
Which is why it should not fail, I will most definitely go back and check
what value is going where.

Kevin

"Albert D.Kallal" wrote in message
news:%23iaKTrJnGHA.4352@TK2MSFTNGP02.phx.gbl...
> The following works:
>
> You can set the limit to yes = to yes.
>
> The, for the no in list event, you can use the following code:
>
>
> Private Sub Combo33_NotInList(NewData As String, Response As Integer)
>
> 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
>
> End Sub
>
> MAKE SURE that the value you are adding is the text field value. The combo
> box is storing a ID field, but the NewData is going to be the text value..
>
> When you code runs, does the value get added to the table correctly
> (simply open the table....and check what is in the list -- make sure the
> text bound column is EXACTLY the same as newdata..or it will fail. In
> addition, do be aware of the
>
> I suspect somewhere in your complex code that replaces the above simple
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=12392
> code that you may has messed up the fact that the combo stores a long
> number id field, but newdata is text....
>
> --
> Albert D. Kallal (Access MVP)
> Edmonton, Alberta Canada
> pleaseNOOSpamKallal@msn.com
> http://www.members.shaw.ca/AlbertKallal
>



Reply With Quote
   Click Here to Donate Now!

Support Us!
Become a Promoter!
Gurfateh ji, you can become a SPN Promoter by Donating as little as $10 each month. With limited resources & high operational costs, your donations make it possible for us to deliver a quality website and spread the teachings of the Sri Guru Granth Sahib Ji, to serve & uplift humanity. Every contribution counts. Donate Generously. Gurfateh!
ReplyPost New Topic In This Forum Stay Connected to Sikhism, Click Here to Register Now!

Bookmarks


(View-All Members who have read this thread : 0
There are no names to display.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Tools Search
Search:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On

» Active Discussions
How does Sikhi help you...
Today 15:00 PM
21 Replies, 840 Views
Keeping Amrit Vela
Today 13:45 PM
6 Replies, 798 Views
Health Exercise And...
Today 13:30 PM
0 Replies, 19 Views
SSGS with English...
Today 12:55 PM
9 Replies, 106 Views
Losing My Religion: Why...
Today 11:52 AM
11 Replies, 254 Views
Rozana Reports (ਪੰਜਾਬੀ...
Today 01:44 AM
310 Replies, 7,534 Views
Sikh Spokesman (ਪੰਜਾਬੀ...
Today 01:30 AM
174 Replies, 4,450 Views
Dalai Lama’s Lessons for...
Today 00:11 AM
0 Replies, 42 Views
30 Day Amrit Vela -...
Yesterday 23:49 PM
45 Replies, 677 Views
What Do You Think of...
Yesterday 22:56 PM
39 Replies, 711 Views
How Religions Change...
Yesterday 19:33 PM
0 Replies, 79 Views
Do you believe in...
Yesterday 12:00 PM
184 Replies, 3,912 Views
Thought of the Moment!
Yesterday 10:07 AM
109 Replies, 5,157 Views
Amrit
Yesterday 09:17 AM
5 Replies, 364 Views
What I believe Hukam to...
Yesterday 03:15 AM
13 Replies, 186 Views
» Books You Should Read...
Powered by vBadvanced CMPS v3.2.3
All times are GMT +6.5. The time now is 15:46 PM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2013, vBulletin Solutions, Inc.
Search Engine Optimization by vBSEO 3.6.0 PL2 Copyright © 2004-12, All Rights Reserved. Sikh Philosophy Network


Page generated in 0.45128 seconds with 32 queries
0