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 19005
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: 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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |