473,569 Members | 2,729 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ODBC - Insert on linked table [tableName] failed issue

46 New Member
Hi guys,

I am having trouble resolving this error. Below mentioned is my code and implmentation.

MS Acess is my front end and sql server is my backend.

What i want to achieve is to be able to insert StudentId in the table matching the values chosen in the combo boxes and listboxes. This sound more like searching the table to insert StudentId matching the criterias.

I have set the necessary configuration for ODBC connection (File DSN & System DSN>Add>Sql Server>) and linked the table from MS Acess (Get external source>ODBC Database>DataSo urce>System>Tab le[Student]) but somehow or rather it jux failed to work.

Is there a possibilty whereby i can combine RecordSet property (rs.AddNew) with sql stat (select stat) The prog just hang at rs.update when i step till it and resulted to [ODBC -insert on linked table [tableName] failed. Do I need to set any connection property for ODBC to sql server? If yes, hw can this be set.

Really at a loss as to hw this can be resolve!

Any solutions, suggestions, pointers, code snippets, correction of codes is very much appreciated.

Control
StudentId - TextBox(Userinp ut)
Combo box1 (predefined values) course
Combo box 2 (populated results from Combo box 1) subject - combo change event
ListBox (populated result from Combo box 2) class - combo change event

Private_Sub SaveCommand
On_Error ....

Dim rs as DAO.RecordSet
Dim db as DAO.Database

Set rs = Me.RecordSetClo ne
Set db = CurrentDb
Set rs = db.OpenRecordSe t("Select StudentId, course, subject, class from Student where studentId = '" & Me.StudentId.va lue & "' And course = '" & Me.Combo1.value & "' And subject = '" & Me.Combo2.value & "'" )
If not rs.EOF then
rs.AddNew
rs("StudentId" ) = Me.text1.value
rs.Update
rs.close

End If

set rs= Nothing
set db =Nothing

Private Sub_AfterUpdate ()

Dim rs as Object

Set rs = Me.RecordSet.Cl one
rs.FindFirst "[Serialno] = " Str(Nz(Me![List1]))
If not rs.EOF then Me.Bookmark = rs.Bookmark
Jan 15 '07 #1
1 4551
nico5038
3,080 Recognized Expert Specialist
I would have expected:

If rs.EOF and rs.BOF then
' no record found for WHERE criteria
rs.AddNew
rs("StudentId" ) = Me.text1.value
' All unique fields from the WHERE should be filled here so add also
rs("Course") = Me.Combo1.value
rs("Subject") = ....
'etc.
rs.Update
rs.close

End If

Nic;o)
Jan 16 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
6937
by: Katuil Katuil | last post by:
Hello All: Have a problem that I have never seen before and have not found anything on technet on how to resolve it. I have a SQL Server 2000 server that I have created a new database. I then used DTS to import data from a MS Access 97 database. Before making the import, I made changes to the MS Access database
6
6758
by: Andreas Lauffer | last post by:
I changed from Access97 to AccessXP and I have immense performance problems. Details: - Access XP MDB with Jet 4.0 ( no ADP-Project ) - Linked Tables to SQL-Server 2000 over ODBC I used the SQL Profile to watch the T-SQL-Command which Access ( who creates the commands?) creates and noticed:
2
15655
by: Pippen | last post by:
I'm currently trying to access data from a Cache DB using MSSQL. I have linked the Cache server through an ODBC connection. I can see in the Linked Server expansion all the tables in Cache for the File(?) I want to access. Here is my problem: Normally to access a linked sever I would do the following: select * from...
2
6096
by: neptune | last post by:
I currently link a table to an Oracle db. Anytime I open a query based off it, I have to input username & password. Is there a way to do this automatically? I'd prefer to use linked tables, but I've read a pass-through query can pass the passwords automatically. The directions seem straightforward, but I can't get one to work. The select...
2
1830
by: Michael | last post by:
High there everyone, I have inherited a database with an odbc table (linking to an oracle database) , we have recently updated our operating environment to windows 2000 (access 2000). since then everytime i try to add a record to the linked table i get the following error ODBC call failed sqlerrm(tablename)(#-391) I have found out that...
0
6862
by: crypto_solid via AccessMonster.com | last post by:
I have been using a SQL database with a VB5 frontend for about 5 years. Works well. Unfortunately I don't have access to the source code. I was tasked with implementing a "job entry" application that will allow a restricted list of users to enter jobs in the database. We do not want these users to be able to access all the data. I created...
0
2117
by: Cunfshon | last post by:
I wrote about this one a while ago, and got a few responces, but nothing resolved the issue. Figured I'd give everyone one more crack at it. I have an established MS Access database using linked tables to an external MS-SQL datasource, through ODBC. I can establish the ODBC link, I can link the tables in a new MS Access database (File ->...
0
3709
by: Igor | last post by:
An error "ODBC connection to failed" is raised when I am trying to get data from a table in Microsoft Access (97, or 2000) which is actually a linked table to another table in SQL Server 7 . The exception is raised from a Web .Net app while exactly the same code works fine in Windows .Net app. That makes me thinking the issue somehow is...
2
2409
by: csgraham74 | last post by:
Hello, im using MS Access as a front end to link to MYSQL. although this is possibly an Access issue i thought someone would be able to help me. the error message "ODBC--insert on a linked table 'tablname' failed" is displayed when i attempt to insert records to the MYSQL table. Does anyone know of a way round this ?? im using the most...
0
7695
marktang
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...
0
7612
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...
0
8119
jinu1996
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...
1
7668
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...
0
7964
tracyyun
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...
1
5509
isladogs
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...
0
5218
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...
0
3637
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
936
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.