Re: Combo "Not in List Event", MS generic message still appears



Hey Mike!

Thanks for you replies - they are really appreciated :-). Sorry about the
tardy reply - I got frustrated and took a day's break!

Thanks for the tip about Stopping (I thought there was a way to do that but
couldn't work out how to 'step' (F8)) :-)) - I've done this for all the
problem scenario possibilities as follows:


I tried adding the [ ] to the OpenRecordset line, but it seems not to work -
it throws an error:

"Run-time error '3078':
The Microsoft Access database engine cannot find the input table or query '
[Term Plans]'. Make sure it exists and that its name is spelled correctly." -
this suggests to me that Access is happy with the " " and sees the brackets
as part of the name.

Proceeding without the brackets, I stepped through the choice of Yes. Access
does indeed step through the following Else statement dealing with adding
NewData to the table (picking up the NewData properly, according to mouse-
over tool-tip), through the line "rs.update", but then, alas, continues to,
and through, the next "If Err" statement, throwing that error. Is the term
"Err" an inbuilt term - it's not set up anywhere? Also note that NewData is
not added to either the table or combo box choices. And because it goes
through this "If Err" bit, it skips the associated Else statement for
acDataErrAdded (which never gets processed).

Also without the brackets, I stepped through the choice of No. Access
appropriately skips the Else statement, straight down to the "End If"
statement and, on the "rs.close" line throws up the same error as previously
mentioned:

"Run-time error '91':
Object variable or With block variable not set."

Prior to stepping through the code (still at stop), I notice that:

Response = 1 (I assume this is the default?)
acDataErrContinue = 0 (This means false?)
acDataErrAdded = 2 (Why?)

Thanks again for your help :-). Any other ideas?

MikeJohnB wrote:
Another Trick

Place a stop in the first line of code
Private Sub ComboSearchCusPtNo_NotInList(NewData As String, Response As
Integer)
Dim Db As DAO.Database
Dim rs As DAO.Recordset
Dim Msg1 As String

Stop
Msg1 = "'" & NewData & "' is not in the list." & vbCr & vbCr
Msg1 = Msg & "Do you want to add it?"
If MsgBox(Msg1, vbQuestion + vbYesNo) = vbNo Then
Response1 = acDataErrContinue
MsgBox "Try again."
Exit Sub

Your code should stop at the line stop. Use the F8 Key to single step
through your code to find the exact line that is throwing an error. Again I
would hazzard a guess at the line

Set rs = db.OpenRecordset("Term Plans", dbOpenDynaset)

If thats the case, it will then jump striaght to the err line

You can also use break points (Alternative to the stop) by double clicking
the edge border of the code window, it should highlight the line in red with
a big red dot in the left hand edge column. To remove, just click again
One consideration, in your code

[quoted text clipped - 136 lines]

Why do I still get the MS generic error messages?

--
Message posted via http://www.accessmonster.com

.



Relevant Pages

  • Re: Combo "Not in List Event", MS generic message still appears
    ... If Err Then ... Response = acDataErrContinue ... Please advise Correct Field Name. ...
    (microsoft.public.access.forms)
  • Re: repli
    ... Private Sub Program_NotInList(NewData As String, Response As Integer) ... Dim cmd As ADODB.Command ... Response = acDataErrContinue ...
    (microsoft.public.access.forms)
  • error 3265: Item not found in this collection
    ... Response As Integer) ... Append NotInList value to combo's recordset. ... else acDataErrContinue ... Dim rst As DAO.Recordset ...
    (microsoft.public.access.formscoding)
  • Re: Combo Box to add items to a table
    ... and the Dim db As DAO.Database line is ... Response As ... Response = acDataErrContinue ... libraries that are checked. ...
    (microsoft.public.access.formscoding)
  • RE: Coding Help - Please
    ... Make the combo an unbound control and add a text box for the SSN that is the ... Response As Integer) ... Dim rs As DAO.Recordset ... Response = acDataErrContinue ...
    (microsoft.public.access.formscoding)