Re: Combo "Not in List Event", MS generic message still appears
- From: "basiltabethacat via AccessMonster.com" <u48523@uwe>
- Date: Sat, 03 Jan 2009 08:27:00 GMT
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
.
- Follow-Ups:
- Re: Combo "Not in List Event", MS generic message still appears
- From: MikeJohnB
- Re: Combo "Not in List Event", MS generic message still appears
- References:
- Re: Combo "Not in List Event", MS generic message still appears
- From: basiltabethacat via AccessMonster.com
- Re: Combo "Not in List Event", MS generic message still appears
- From: MikeJohnB
- Re: Combo "Not in List Event", MS generic message still appears
- From: MikeJohnB
- Re: Combo "Not in List Event", MS generic message still appears
- From: MikeJohnB
- Re: Combo "Not in List Event", MS generic message still appears
- Prev by Date: Re: Creating a form in Excel for Data Entry
- Next by Date: How on earth do you save a record programatically?
- Previous by thread: Re: Combo "Not in List Event", MS generic message still appears
- Next by thread: Re: Combo "Not in List Event", MS generic message still appears
- Index(es):
Relevant Pages
|