i am trying to get the NotInList function working properly in MSAccess. my scenario is that i am trying to get it to add names to a combo list box if they aren't already in there. i gets to the point where the popup asks me if i want to add the user to the list. i click yes and i get "424 - object required". i have been looking on the internet for a few days now on how to resolve it, but no luck. hopefully someone here can help me. thanks in advance. [code below]
*PRININVEST is the name of the combolist box
*the rest of the code was copied from someone else, so it might just be something not matching, but then again the Object required is coming up...
Private Sub PRININVEST_NotInList(NewData As String, Response As Integer)
Const cProcedureName As String = "PRININVEST_NotInList"
On Error GoTo err_handler
Dim db As DAO.Database
Dim rst As ADODB.Recordset
If MsgBox("This name doesn't exist. Add?", vbYesNo + vbQuestion) = vbYes Then
Set db = DBEngine(0)(0)
Set rst = db.OpenRecordset(proposal.PRININVEST)
rst.AddNew
rst!StateDesc = NewData
rst.Update
Response = acDataErrAdded
Else
Me.Undo
Response = acDataErrContinue
End If
Exit_Sub:
On Error Resume Next
rst.Close
Set rst = Nothing
Set db = Nothing
Exit Sub
err_handler:
Select Case Err
Case Else
'Call LogError(err.Number, err.Description, cModuleName & cProcedureName)
MsgBox Err.Number & " - " & Err.Description
End Select
Resume Exit_Sub
End Sub
1 7193 PEB 1,418
Expert 1GB
i am trying to get the NotInList function working properly in MSAccess. my scenario is that i am trying to get it to add names to a combo list box if they aren't already in there. i gets to the point where the popup asks me if i want to add the user to the list. i click yes and i get "424 - object required". i have been looking on the internet for a few days now on how to resolve it, but no luck. hopefully someone here can help me. thanks in advance. [code below]
*PRININVEST is the name of the combolist box
*the rest of the code was copied from someone else, so it might just be something not matching, but then again the Object required is coming up...
Private Sub PRININVEST_NotInList(NewData As String, Response As Integer)
Const cProcedureName As String = "PRININVEST_NotInList"
On Error GoTo err_handler
Dim db As DAO.Database
Dim rst As ADODB.Recordset
If MsgBox("This name doesn't exist. Add?", vbYesNo + vbQuestion) = vbYes Then
Set db = DBEngine(0)(0)
Set rst = db.OpenRecordset(proposal.PRININVEST)
rst.AddNew
rst!StateDesc = NewData
rst.Update
Response = acDataErrAdded
Else
Me.Undo
Response = acDataErrContinue
End If
Exit_Sub:
On Error Resume Next
rst.Close
Set rst = Nothing
Set db = Nothing
Exit Sub
err_handler:
Select Case Err
Case Else
'Call LogError(err.Number, err.Description, cModuleName & cProcedureName)
MsgBox Err.Number & " - " & Err.Description
End Select
Resume Exit_Sub
End Sub
Hi,
try: -
Private Sub PRININVEST_NotInList(NewData As String, Response As Integer)
-
Const cProcedureName As String = "PRININVEST_NotInList"
-
On Error GoTo err_handler
-
Dim db As Database
-
Dim rst As Recordset
-
-
If MsgBox("This name doesn't exist. Add?", vbYesNo + vbQuestion) = vbYes Then
-
Set db = Currentdb()
-
Set rst = db.OpenRecordset("proposal.PRININVEST")
-
rst.AddNew
-
rst("StateDesc") = NewData
-
rst.Update
-
Response = acDataErrAdded
-
Else
-
Me.Undo
-
Response = acDataErrContinue
-
End If
-
-
Exit_Sub:
-
On Error Resume Next
-
rst.Close
-
Set rst = Nothing
-
Set db = Nothing
-
Exit Sub
-
err_handler:
-
Select Case Err
-
Case Else
-
'Call LogError(err.Number, err.Description, cModuleName & cProcedureName)
-
MsgBox Err.Number & " - " & Err.Description
-
End Select
-
Resume Exit_Sub
-
End Sub
-
Hope that proposal.PRININVEST is the name of a table!
:)
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Nicola |
last post by:
Hi Everyone,
I am new to programming and would like to know how to
open an access Report from within vb 6. I am trying to write a program
to organise cross stitch threads. I have found out how...
|
by: Fabian von Romberg |
last post by:
Hi, I have installed Sql Reporting Services on 2 machines, one is WIN 2000
PRO and the other one is WIN 2000 ADV. SERVER. When I try to access a
report using the webbrowser, I get the following...
|
by: annie |
last post by:
Hi all,
I have recently ported my Access 2000 app to SQL Server, keeping the
Access client as the front end using linked tables.
I am also using triggers on my SQL tables to trap orphan...
|
by: Peter Frost |
last post by:
Please help
I don't know if this is possible but what I would really like to do is
to use On Error Goto to capture the code that is being executed when
an error occurs.
Any help would be much...
|
by: Yannick Turgeon |
last post by:
Hello,
We are in the process of examining our current main application. We have to
do some major changes and, in the process, are questionning/validating the
use of MS Access as front-end. The...
|
by: Fish Womper |
last post by:
I am at best a part time developer of Access databases. I use Access
2.0, as this is all my employer has on its computers. Even so, to use
this ancient version requires a fairly convoluted...
|
by: bazzer |
last post by:
hey,
im trying to access a microsoft access database from an ASP.NET web
application in visual basic 2003.NET. i get the following error when i
try running it:
Server Error in...
|
by: Greg Strong |
last post by:
Hello All,
The short questions are
1 Do you know how to make DSN connection close in Access to Oracle 10g
Express Edition?
&/or
2 Do you know how to make a DSN-less pass-through query...
|
by: Sebastian |
last post by:
Hello
I develop my applications in Access 2002. My development system is
running Windows XP SP2 and I have Microsoft Office XP Developer.
Microsoft Office XP is at SP3.
I used Inno Setup (great...
|
by: hyperpau |
last post by:
Before anything else, I am not a very technical expert when it comes to VBA coding.
I learned most of what I know by the excellent Access/VBA forum from bytes.com (formerly thescripts.com).
Ergo, I...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |