By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,970 Members | 1,669 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,970 IT Pros & Developers. It's quick & easy.

Access OnNotInList sooo Frustrated

P: n/a
I was hoping someone could help me with the OnNotInList function from
Access. I downloaded this code below. I keep getting an error on
the fAddToList – Sub or Function not defined. Please help – I am
soooo frustrated.
Private Sub Combo30_NotInList(NewData As String, Response As Integer)
If MsgBox(NewData & " is not in the Day table, do you wish to add
it?", vbYesNo, "Day not found") = vbYes Then
If fAddToList(NewData, "Awarded") Then
Response = acDataErrAdded
Else
Response = acDataErrContinue
End If
Else
Response = acDataErrContinue
End If
End Sub
Nov 13 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Hi Mary,

"fAddToList" is a custom function, likely created by the same person that
wrote the rest of this. If you're missing that function, the rest of the
code is almost useless.

I had posted a reply (06/25)
http://groups.google.ca/groups?q=Don...lgrps12&rnum=3
to your previous post on this subject, wherein I had attempted to explain
that there are several ways to use the NotInList event, depending on your
circumstances. I had also included a working sample from my application, but
mentioned that you would have to adapt it to suit your needs. Did you try
that at all? I realize your frustration, and feel for you ... but the fact
remains that you can't just copy and paste someone else's code verbatim and
expect it to work for you.

Try replying to this post, describing in detail what it is that you are
trying to do. Also include any relevant code and error messages.

--
HTH,
Don
=============================
Use My*****@Telus.Net for e-mail
Disclaimer:
Professional PartsPerson
Amateur Database Programmer {:o)

I'm an Access97 user, so all posted code
samples are also Access97- based
unless otherwise noted.

Do Until SinksIn = True
File/Save, <slam fingers in desk drawer>
Loop

================================

"MaryO" <mo***@aescurb.com> wrote in message
news:f8**************************@posting.google.c om...
I was hoping someone could help me with the OnNotInList function from
Access. I downloaded this code below. I keep getting an error on
the fAddToList - Sub or Function not defined. Please help - I am
soooo frustrated.
Private Sub Combo30_NotInList(NewData As String, Response As Integer)
If MsgBox(NewData & " is not in the Day table, do you wish to add
it?", vbYesNo, "Day not found") = vbYes Then
If fAddToList(NewData, "Awarded") Then
Response = acDataErrAdded
Else
Response = acDataErrContinue
End If
Else
Response = acDataErrContinue
End If
End Sub

Nov 13 '05 #2

P: n/a
Try

Option Explicit
Option Compare Database
Private Sub JobID_NotInList(NewData As String, Response As Integer)

Dim strMsg As String
Dim rst As Recordset
Dim db As Database

strMsg = "'" & NewData & "' is not in the list. "
strMsg = strMsg & "Would you like to add it?"
If MsgBox(strMsg, vbQuestion + vbYesNo, "New Job Description") = vbNo
Then
Response = acDataErrDisplay
Else
Set db = CurrentDb()
Set rst = db.OpenRecordset("Jobs", DB_OPEN_TABLE)
rst.AddNew
rst!Job = NewData
rst.Update
Response = acDataErrAdded
rst.Close
End If

End Sub

This adds a job to a list of jobs. may I suggest you give your Combo box a
meaningful name rather than Combo30 Your code calls a function
fAddToList which you have not defined.
If you have Option Explicit at the top of your module, I believe it will
give a compilation error if it can't find somethin refered to in your code.
I always have

Option Explicit
Option Compare Database

at the top of all modules

HTH

Phil
"MaryO" <mo***@aescurb.com> wrote in message
news:f8**************************@posting.google.c om...
I was hoping someone could help me with the OnNotInList function from
Access. I downloaded this code below. I keep getting an error on
the fAddToList - Sub or Function not defined. Please help - I am
soooo frustrated.
Private Sub Combo30_NotInList(NewData As String, Response As Integer)
If MsgBox(NewData & " is not in the Day table, do you wish to add
it?", vbYesNo, "Day not found") = vbYes Then
If fAddToList(NewData, "Awarded") Then
Response = acDataErrAdded
Else
Response = acDataErrContinue
End If
Else
Response = acDataErrContinue
End If
End Sub

Nov 13 '05 #3

P: n/a

Thank you sooo much Phil - it works great. I have looked everywhere for
something to work. THANK YOU!!!!
Mary O
*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 13 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.