473,386 Members | 1,799 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

ODBC - Insert on linked table [tableName] failed issue

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>DataSource>System>Table[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(Userinput)
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.RecordSetClone
Set db = CurrentDb
Set rs = db.OpenRecordSet("Select StudentId, course, subject, class from Student where studentId = '" & Me.StudentId.value & "' 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.Clone
rs.FindFirst "[Serialno] = " Str(Nz(Me![List1]))
If not rs.EOF then Me.Bookmark = rs.Bookmark
Jan 15 '07 #1
1 4527
nico5038
3,080 Expert 2GB
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
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...
6
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...
2
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...
2
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,...
2
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...
0
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...
0
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...
0
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...
2
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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,...
0
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...
0
Oralloy
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,...
0
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...

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.