I have an access 97 database linked to sql server..I click update on a
form
and get an error message:
Run-time error 3146 ODBC call failed
The debugger points to this line:
MyTable.Update
In this segment of code:
Private Sub Update5_Click()
Dim MyDB As Database, MyTable As Recordset, MyTmpTable As
Recordset,
Criteria As String, NewID As Long
Set MyDB = DBEngine.Worksp aces(0).Databas es(0)
Set MyTable = MyDB.OpenRecord set("Dx5", DB_OPEN_DYNASET ,
dbSeeChanges)
Set MyTmpTable = MyDB.OpenRecord set("tmp_RockDx 5",
DB_OPEN_DYNASET )
MyTable.AddNew
MyTable.Update
MyTable.Move 0, MyTable.LastMod ified
NewID = MyTable![Dx5ID]
Me![HoldNewDxID] = NewID
If DCount("*", "Dx5Current ") > 0 Then
Me![HoldOldDxID] = Me![Dx5Current].Form![Dx5ID]
'Put end date on the current
Axis 5
'record
Me![Dx5Current].Form![EndDate] = Date
DoCmd.DoMenuIte m A_FORMBAR, A_FILE, A_SAVERECORD
'Copy in data from the current
Axis 5
'record to the new record,
since it is
'likely to be similar
Set MyTable = MyDB.OpenRecord set("Dx5", DB_OPEN_DYNASET )
holdnum = Forms![DxSummary]![HoldNewDxID]
Criteria = "[Dx5ID] = " & holdnum
MyTable.FindFir st Criteria
MyTable.Edit
MyTable![CurrentGAF] = Me![Dx5Current].Form![CurrentGAF]
MyTable![HighestGAFLastY ear] =
Me![Dx5Current].Form![HighestGAFLastY ear]
MyTable.Update
End If
Me.Visible = False
Me![Dx5Current].Requery 'This is necessary in order to
release the
'record, so that it can be edited
if the
'user uses the Cancel button on the
add-edit
'form
Criteria = "[Dx5ID] = Forms![DxSummary]![HoldNewDxID]"
DoCmd.OpenForm "AddDx5", , , Criteria, A_EDIT
MyTmpTable.Clos e
MyTable.Close
Forms![AddDx5]![ClientID] = Forms![LogIn]![ActiveClient]
Forms![AddDx5]![StaffID] = Forms![LogIn]![ActiveStaff]
End Sub 2 19010
Since you are getting an ODBC error, I assume you're using linked tables. The
ODBC call failed error is the same for -any- server-side failure, and is not
terribly informative. To get the useful error information in these cases, you
must examine the Errors collection.
Looking at what you're doing, though, I'm guessing the table has one or more
required fields with no default values, so doing an Update immediately after
an AddNew is trying to create a new record without the minimum required field
data.
On 29 Mar 2005 07:00:05 -0800, "Jimbo" <ji********@mot orola.com> wrote: I have an access 97 database linked to sql server..I click update on a form and get an error message:
Run-time error 3146 ODBC call failed
The debugger points to this line:
MyTable.Upda te
In this segment of code:
Private Sub Update5_Click()
Dim MyDB As Database, MyTable As Recordset, MyTmpTable As Recordset, Criteria As String, NewID As Long Set MyDB = DBEngine.Worksp aces(0).Databas es(0) Set MyTable = MyDB.OpenRecord set("Dx5", DB_OPEN_DYNASET , dbSeeChanges ) Set MyTmpTable = MyDB.OpenRecord set("tmp_RockDx 5", DB_OPEN_DYNASE T)
MyTable.AddNew MyTable.Update MyTable.Move 0, MyTable.LastMod ified NewID = MyTable![Dx5ID]
Me![HoldNewDxID] = NewID
If DCount("*", "Dx5Current ") > 0 Then
Me![HoldOldDxID] = Me![Dx5Current].Form![Dx5ID]
'Put end date on the current Axis 5 'record
Me![Dx5Current].Form![EndDate] = Date DoCmd.DoMenuIte m A_FORMBAR, A_FILE, A_SAVERECORD
'Copy in data from the current Axis 5 'record to the new record, since it is 'likely to be similar
Set MyTable = MyDB.OpenRecord set("Dx5", DB_OPEN_DYNASET )
holdnum = Forms![DxSummary]![HoldNewDxID] Criteria = "[Dx5ID] = " & holdnum MyTable.FindFir st Criteria MyTable.Edit MyTable![CurrentGAF] = Me![Dx5Current].Form![CurrentGAF] MyTable![HighestGAFLastY ear] = Me![Dx5Current].Form![HighestGAFLastY ear] MyTable.Update
End If
Me.Visible = False Me![Dx5Current].Requery 'This is necessary in order to release the 'record, so that it can be edited if the 'user uses the Cancel button on the
add-edit 'form
Criteria = "[Dx5ID] = Forms![DxSummary]![HoldNewDxID]"
DoCmd.OpenForm "AddDx5", , , Criteria, A_EDIT
MyTmpTable.Clos e MyTable.Close
Forms![AddDx5]![ClientID] = Forms![LogIn]![ActiveClient] Forms![AddDx5]![StaffID] = Forms![LogIn]![ActiveStaff]
End Sub
I found out the problem....it was because of an ntext field in the
table..I changed it to a varchar and it works fien now...but at least
your suggestion got me looking at the underlying table
structure...tha nks
-Jim This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Vic Spainhower |
last post by:
Hello,
This is probably not the correct forum to post this problem but I posted it
in the Access group but didn't get a reply and I'd like to move forward on
this.
I have setup an ODBC Connection to a MySQL database (driver version is 3.51)
but when I setup the link in MS Access 2002 some of the tables will show
#Name? in all of the fields, some will show #Deleted in all of the fields
and some will work (except I can't update them). ...
|
by: Eric E |
last post by:
Two questions regarding ODBC.
1) I am connecting to a MySQL database using the following code:
Function LoginToMySQL(sUsername As String, sPW As String) As Boolean
Dim dbMySQL As Database
Dim cnMySQL As DAO.Connection
Dim sDSN As String
sDSN = "ODBC;DRIVER={MySQL ODBC 3.51 Driver};" _
& "SERVER=127.0.0.1;" _
|
by: Charles |
last post by:
Ok, I have an Access 97 GUI with SQL 7.0 backend. On one database I'm
constantly getting a call fail. I'm not sure why. From the user
accounts it seems to happen mostly when they have the form open, but
are static...doing something else. They begin to enter a record and
when they go to move to another record or save they get the error, but
not everytime. When the error occurs, they have to close out of the
database and open it back...
|
by: Abhi |
last post by:
FYI:
This message is for the benefit of MS Access Community. I found that
this prblem has been encounterd by many but there is hardly any place
where a complete solution is posted. So I thought I should give back
to the community by posting our findings.
Thanks you all for all your help till now by posting problems and
their solutions.
~Abhijit
|
by: VBSponge |
last post by:
Hi all. Need help here as I cant see whats wrong...
I have a querydef in Access 2k which execs a stored proc in a SQL
Server 2k db.
I keep getting the following error, and cant stop it for the life of
me:
"Error 3146: ODBC Call Failed"
Now, the stored proc uses @RETURN_VALUE to pass back an integer result
| |
by: Doolittle |
last post by:
Hi,
I'm a relatively new VBA programmer but have been given the task of
repairing a database that currently appears with "3146 ODBC--call
failed." This happens when various criteria are input into a form
(called InvCredit), and then cmdProcess is clicked. Then we are asked
if we can "Confirm you want to process?" and when Yes is clicked the
error appears. Following is the code. I have found that the break
appears at the .Update point...
|
by: Greg Strong |
last post by:
Hello All,
What is the maximum length of an ODBC pass through query?
Things work fine with the code except when I try to create a view which
is pretty complex in Oracle. I'm using a DSN provided with the Oracle
Express Edition and using Access 2k2 as the front-end. When I debug
print the SQL and paste it into SQLplus it works fine. The length of
the debug print that works is 1988 characters. Since the exact same
code works with...
|
by: hello_2you |
last post by:
Hello,
I have a vb program that connects to odbc to an sqlexpress server. When
i try to write data to the db, i get this message:
Release Error: Script #1 (Ascent Capture Database)
"de oproep is mislukt" is dutch for "Call failed"
It is an on/off problem, sometimes it works perfectly, but when i try
|
by: network-admin |
last post by:
We have Problems with Access query on Oracle 10g Database with ODBC
Connection.
The Query_1 is such as
select *
from xtable
where ycolumn <"S"
Result = ODBC Faild
----------------------------------------------------
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |