ODBC situation, Access 97, here is the code and I've marked where
Access coughs up. The Access error message is 3027, can't update,
database is read only. The Oracle table in question has a primary key
defined as TEST_PK which is, of course, also an index:
Private Sub btnSave_Click()
Dim dbs As DAO.Database
Dim rst As DAO.Recordset
Dim qdf1 As DAO.QueryDef
Set dbs = Access.CurrentD b
Set qdf1 = dbs.CreateQuery Def("")
With qdf1
'The following connect string is correct. It works for all select
'statements and also works with insert statements when I
'perform .execute dbfailonerror
.Connect = "ODBC;DSN=b lah blah"
.SQL = "Select test_pk, test_tim1, testtim2 from tim_test"
.ReturnsRecords = True
Set rst = .OpenRecordset
End With
With rst
.AddNew 'THIS IS WHERE THE ERROR IS THROWN
.Fields!tim_tes t1 = Me.txt1
.Fields!timtest 2 = Me.txtNumber
.Update
MsgBox .Fields!TEST_PK
.Close
End With
Set rst = Nothing
Set qdf1 = Nothing
Set dbs = Nothing
End Sub
If anyone can help, I'd really appreciate it. I'm tearing my hair out.
--
Tim - http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "Want some?" - Ditto 2 7089
Thanks TC, I appreciate the suggestion. I always though you could not
"embed" with/end withs? However, I tried it and didn't use the with
rst, ie, used rst.addnew. But I get the same response. Actually, the
format I used originally is what I always use when I'm doing .execute
methods and if I change the sql to an append/insert query, the insert
works, so it's got nothing to do with Oracle permissions either.
Thanks...
TC wrote: This is a real stab in the dark, but, are you sure it is cosher to close the 'with qdf1' before you have finished with rst? Try moving the first 'end with' down to the end, next to the last one. I doubt this is it, but you may as well give it a try.
TC
"Tim Marshall" <tm******@morga n.ucs.mun.ca> wrote in message news:3F******** *******@morgan. ucs.mun.ca... ODBC situation, Access 97, here is the code and I've marked where Access coughs up. The Access error message is 3027, can't update, database is read only. The Oracle table in question has a primary key defined as TEST_PK which is, of course, also an index:
Private Sub btnSave_Click()
Dim dbs As DAO.Database Dim rst As DAO.Recordset Dim qdf1 As DAO.QueryDef
Set dbs = Access.CurrentD b
Set qdf1 = dbs.CreateQuery Def("")
With qdf1
'The following connect string is correct. It works for all select 'statements and also works with insert statements when I 'perform .execute dbfailonerror
.Connect = "ODBC;DSN=b lah blah"
.SQL = "Select test_pk, test_tim1, testtim2 from tim_test"
.ReturnsRecords = True
Set rst = .OpenRecordset
End With
With rst
.AddNew 'THIS IS WHERE THE ERROR IS THROWN
.Fields!tim_tes t1 = Me.txt1
.Fields!timtest 2 = Me.txtNumber
.Update
MsgBox .Fields!TEST_PK
.Close
End With
Set rst = Nothing
Set qdf1 = Nothing
Set dbs = Nothing
End Sub
If anyone can help, I'd really appreciate it. I'm tearing my hair out.
-- Tim - http://www.ucs.mun.ca/~tmarshal/ ^o< /#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake /^^ "Want some?" - Ditto
--
Tim - http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "Want some?" - Ditto
Yes, it's fine to embed with/end withs:
with this
.method
.method
with that
x = .property
etc.
end with
.method
end with
Using rst.addnew is not quite what I meant. You had: With qdf1 .props = values Set rst = .OpenRecordset End With With rst .AddNew 'THIS IS WHERE THE ERROR IS THROWN End With
I wondered whether the validity of the recordset was affected by having
closed the first with/end with. So I meant for you to try this:
With qdf1 .props = values Set rst = .OpenRecordset With rst .AddNew 'THIS IS WHERE THE ERROR IS THROWN End With End With
I doubt that will fix it. But I don't have Access here to check, so it is
maybe worth a try.
Cheers,
TC
"Tim Marshall" <tm******@Gunne r.Sabot.Spam.On .Loaded.FIRE> wrote in message
news:3F******** *******@Gunner. Sabot.Spam.On.L oaded.FIRE... Thanks TC, I appreciate the suggestion. I always though you could not "embed" with/end withs? However, I tried it and didn't use the with rst, ie, used rst.addnew. But I get the same response. Actually, the format I used originally is what I always use when I'm doing .execute methods and if I change the sql to an append/insert query, the insert works, so it's got nothing to do with Oracle permissions either.
Thanks...
TC wrote: This is a real stab in the dark, but, are you sure it is cosher to close
the 'with qdf1' before you have finished with rst? Try moving the first
'end with' down to the end, next to the last one. I doubt this is it, but you
may as well give it a try.
TC
"Tim Marshall" <tm******@morga n.ucs.mun.ca> wrote in message news:3F******** *******@morgan. ucs.mun.ca... ODBC situation, Access 97, here is the code and I've marked where Access coughs up. The Access error message is 3027, can't update, database is read only. The Oracle table in question has a primary key defined as TEST_PK which is, of course, also an index:
Private Sub btnSave_Click()
Dim dbs As DAO.Database Dim rst As DAO.Recordset Dim qdf1 As DAO.QueryDef
Set dbs = Access.CurrentD b
Set qdf1 = dbs.CreateQuery Def("")
With qdf1
'The following connect string is correct. It works for all select 'statements and also works with insert statements when I 'perform .execute dbfailonerror
.Connect = "ODBC;DSN=b lah blah"
.SQL = "Select test_pk, test_tim1, testtim2 from tim_test"
.ReturnsRecords = True
Set rst = .OpenRecordset
End With
With rst
.AddNew 'THIS IS WHERE THE ERROR IS THROWN
.Fields!tim_tes t1 = Me.txt1
.Fields!timtest 2 = Me.txtNumber
.Update
MsgBox .Fields!TEST_PK
.Close
End With
Set rst = Nothing
Set qdf1 = Nothing
Set dbs = Nothing
End Sub
If anyone can help, I'd really appreciate it. I'm tearing my hair
out. -- Tim - http://www.ucs.mun.ca/~tmarshal/ ^o< /#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake /^^ "Want some?" - Ditto
-- Tim - http://www.ucs.mun.ca/~tmarshal/ ^o< /#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake /^^ "Want some?" - Ditto This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Jan van Veldhuizen |
last post by:
I have an application which is running fine with MS SqlServer, but it should
be working with Oracle as weel.
At a lot of places we rely upon the ADO Recordset to return incremented
identity columns.
Oralce however returns null or zero.
How can this be fixed easily?
Dim mConn As New ADODB.Connection
Dim rs As New ADODB.Recordset
|
by: Jon Trelfa |
last post by:
I have been fighting with this script for several days and I'm finally
at the end of my rope. Here's the scenario:
-I have to add an entry into 1 table, called "calendar"
-I must retrieve the newly created autonumber field from this record
-Use the new ID number and insert it into a second table called
"cal_details"
--------------Begin Code--------------------
connString = "dsn=atpm"
|
by: Bill Short |
last post by:
The following code copies recordset rs into recordet rst and adds it
to tblVMSParts. The records being copied are the data that shows on a
subform. I copy all of the data from the main record, create a new
record, paste it all in with a new key and then create the subform
records with the new key (). This works perfectly if I have no
relationship declared between the parent table and the child table.
As soon as I set up the relationship...
|
by: dixie |
last post by:
I have some code that adds new records into a table for each ID in a list
box when a button on a form is clicked. This works fine. My problem now is
that I wish to be able to edit all the records for people whose ID is in the
list box. I made minor changes to the code (mainly replacing rs.AddNew with
rs.Edit)and it appears to be updating only the first record and then
overwriting that record with the next, etc until it runs out of ID's...
|
by: Harold |
last post by:
Sat I have a customers table with the fields CustomerID and Customer and I use
the recordset.addnew method to add a new record to the table. What is the best
way to get the CustomerID of the new record after recordset.update is executed?
Recordset!CustomerID doesn't work because the recordset bookmark is on the first
record. Moving to the last record doesn't work if the recordset is based on a
query and the recordset is sorted.
Thanks!
...
| |
by: pillmill |
last post by:
I replaced AddNew statments with INSERT INTO, but am unable to
write to the same tables. Foreign keys violations are
the main errors. Why are these occuring ?
Before:
set rs3= db.OpenRecordset("tblMat", dbOpenDynaset)
rs3.AddNew
rs3!Mat = Rs!Mat
rs3.Update
|
by: Leonardo |
last post by:
Hi. I'm trying to build my first application with database access using VB
2005. I'm a VB 6 programmer and learning everything again has been
challenging. I managed to write a code using some tips from a book I
recently bought. The navigation works fine. My problem starts when it comes
to adding new registers. I have three tables: clients, addresses and
telephones, so the client can have multiple address and telephones. The
client data is...
|
by: Cong |
last post by:
I have a main form (Main-member) with a cancel button. When user
click on the button, it open up another form (Frame40) and the user can
choose a cancel option and double click to close. But occasionally
the first 4 lines does not get executed. Does this has to do requery
issue?
Private Sub Frame40_DblClick(Cancel As Integer)
On Error GoTo Err_Frame40_DblClick
|
by: the other john |
last post by:
ok, for a change I'm looking for why something "does" work.
I wanted to insert a record into an Access DB and then retrieve the
value that was just inserted. I came across this...
http://support.microsoft.com/default.aspx/kb/221931
I tried this out and it seemed to work but what I noticed is that when
it printed out the value "before" the requery it already contained the
value I was looking for. So, for some reason, this works. ...
|
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: 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: 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: 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: 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.
| |
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |