I'm using Access2002, and can't seem to get an updateable recordset going
:-(
What am I doing wrong, here's the code. The form's controls are not locked,
the recordset type is Dynaset (changing to Dynaset inconsistent updates does
not work), I'm allowing edits, and I'm at a loss ...
Please help!
Option Compare Database
Public rstMember As New Recordset
Public cntConn1 As New Connection
Public cmd As New Command
Private Sub Form_Close()
rstMember.Close
cntConn1.Close
Set rstMember = Nothing
Set cntConn1 = Nothing
Set cmd = Nothing
End Sub
Private Sub Form_Load()
Dim i As Integer
Dim cntl As Control
Dim fld As Field
'Specify the connect string
cntConn1.Connec tionString = "DSN=test;uid=a dmin;pwd="
'Open the connection
cntConn1.Open
'Specify the SQL statement
cmd.ActiveConne ction = cntConn1
cmd.CommandText = "SELECT LName FROM tblMemberInfo"
'Open the recordset
rstMember.Curso rLocation = adUseClient
rstMember.Open cmd, , adOpenStatic, adLockBatchOpti mistic, adCmdText
Me.UniqueTable = "tblMemberI nfo"
Set Me.Recordset = rstMember
For Each fld In rstMember.Field s
For Each cntl In Me.Controls
If cntl.Name = fld.Name Then
cntl.ControlSou rce = fld.Name
End If
Next
Next
End Sub 4 5522
On Fri, 23 Jan 2004 22:47:04 GMT, "MNC" <HT****@rogers. com> wrote:
Perhaps the table doesn't have a Primary Key?
-Tom. I'm using Access2002, and can't seem to get an updateable recordset going :-(
What am I doing wrong, here's the code. The form's controls are not locked, the recordset type is Dynaset (changing to Dynaset inconsistent updates does not work), I'm allowing edits, and I'm at a loss ...
Please help!
Option Compare Database Public rstMember As New Recordset Public cntConn1 As New Connection Public cmd As New Command
Private Sub Form_Close() rstMember.Close cntConn1.Close
Set rstMember = Nothing Set cntConn1 = Nothing Set cmd = Nothing
End Sub
Private Sub Form_Load()
Dim i As Integer Dim cntl As Control Dim fld As Field
'Specify the connect string cntConn1.Connec tionString = "DSN=test;uid=a dmin;pwd=" 'Open the connection cntConn1.Open
'Specify the SQL statement cmd.ActiveConne ction = cntConn1 cmd.CommandText = "SELECT LName FROM tblMemberInfo"
'Open the recordset rstMember.Curso rLocation = adUseClient rstMember.Open cmd, , adOpenStatic, adLockBatchOpti mistic, adCmdText Me.UniqueTable = "tblMemberI nfo"
Set Me.Recordset = rstMember For Each fld In rstMember.Field s For Each cntl In Me.Controls If cntl.Name = fld.Name Then cntl.ControlSou rce = fld.Name End If Next Next
End Sub
Access will allow you to bind a recordset to a form at run-time, but it's not
very happy unless the recordset was opened using using the standard Access ADO
driver, either directly or as a wrapper around the SQL Server provider. It
looks to me like you are using the ODBC provider, and Access form's (as of
Access 2002) don't deal with that where editing is concerned.
Now, for the next problem. Access does not play well with BatchOptimistic ADO
recordsets. It will let you "edit" them, but somehow, Access reaches
underneath the recordset and writes directly to the underlying values instead
of the updated values. This is completely broken behavior because, not only
has the value change -not- been recorded, but the supposedly pristine record
of the original state has been overwritten, so it appears that the back-end
data has been changed by another user since the edit began.
For all I know, this may all have changed in Access 2003, but I haven't heard
one way or the other. ADO in Access doesn't seem to have caught on enough for
there to be many folks out there reporting on what has or hasn't improved in
this regard, and I haven't gotten around to checking it out myself.
On Fri, 23 Jan 2004 22:47:04 GMT, "MNC" <HT****@rogers. com> wrote: I'm using Access2002, and can't seem to get an updateable recordset going :-(
What am I doing wrong, here's the code. The form's controls are not locked, the recordset type is Dynaset (changing to Dynaset inconsistent updates does not work), I'm allowing edits, and I'm at a loss ...
Please help!
Option Compare Database Public rstMember As New Recordset Public cntConn1 As New Connection Public cmd As New Command
Private Sub Form_Close() rstMember.Close cntConn1.Close
Set rstMember = Nothing Set cntConn1 = Nothing Set cmd = Nothing
End Sub
Private Sub Form_Load()
Dim i As Integer Dim cntl As Control Dim fld As Field
'Specify the connect string cntConn1.Connec tionString = "DSN=test;uid=a dmin;pwd=" 'Open the connection cntConn1.Open
'Specify the SQL statement cmd.ActiveConne ction = cntConn1 cmd.CommandText = "SELECT LName FROM tblMemberInfo"
'Open the recordset rstMember.Curso rLocation = adUseClient rstMember.Open cmd, , adOpenStatic, adLockBatchOpti mistic, adCmdText Me.UniqueTable = "tblMemberI nfo"
Set Me.Recordset = rstMember For Each fld In rstMember.Field s For Each cntl In Me.Controls If cntl.Name = fld.Name Then cntl.ControlSou rce = fld.Name End If Next Next
End Sub
Thank you for the detailed explanation. I can easily remove the
BatchOptimistic as I don't really need that: it just slipped in as part of
me trying to get this going.
As for the first, you are in fact correct: I am connecting using the MS
ODBC Driver for Access. I'm learning how to do this by applying general
principles I learned over the years, and the help file: all the references I
find pretty much assume the use of some ODBC driver or another. Where do I
find/install the Access ADO driver?
"Steve Jorgensen" <no****@nospam. nospam> wrote in message
news:ls******** *************** *********@4ax.c om... Access will allow you to bind a recordset to a form at run-time, but it's
not very happy unless the recordset was opened using using the standard Access
ADO driver, either directly or as a wrapper around the SQL Server provider.
It looks to me like you are using the ODBC provider, and Access form's (as of Access 2002) don't deal with that where editing is concerned.
Now, for the next problem. Access does not play well with BatchOptimistic
ADO recordsets. It will let you "edit" them, but somehow, Access reaches underneath the recordset and writes directly to the underlying values
instead of the updated values. This is completely broken behavior because, not
only has the value change -not- been recorded, but the supposedly pristine
record of the original state has been overwritten, so it appears that the
back-end data has been changed by another user since the edit began.
For all I know, this may all have changed in Access 2003, but I haven't
heard one way or the other. ADO in Access doesn't seem to have caught on enough
for there to be many folks out there reporting on what has or hasn't improved
in this regard, and I haven't gotten around to checking it out myself.
On Fri, 23 Jan 2004 22:47:04 GMT, "MNC" <HT****@rogers. com> wrote:
I'm using Access2002, and can't seem to get an updateable recordset going :-(
What am I doing wrong, here's the code. The form's controls are not
locked,the recordset type is Dynaset (changing to Dynaset inconsistent updates
doesnot work), I'm allowing edits, and I'm at a loss ...
Please help!
Option Compare Database Public rstMember As New Recordset Public cntConn1 As New Connection Public cmd As New Command
Private Sub Form_Close() rstMember.Close cntConn1.Close
Set rstMember = Nothing Set cntConn1 = Nothing Set cmd = Nothing
End Sub
Private Sub Form_Load()
Dim i As Integer Dim cntl As Control Dim fld As Field
'Specify the connect string cntConn1.Connec tionString = "DSN=test;uid=a dmin;pwd=" 'Open the connection cntConn1.Open
'Specify the SQL statement cmd.ActiveConne ction = cntConn1 cmd.CommandText = "SELECT LName FROM tblMemberInfo"
'Open the recordset rstMember.Curso rLocation = adUseClient rstMember.Open cmd, , adOpenStatic, adLockBatchOpti mistic, adCmdText Me.UniqueTable = "tblMemberI nfo"
Set Me.Recordset = rstMember For Each fld In rstMember.Field s For Each cntl In Me.Controls If cntl.Name = fld.Name Then cntl.ControlSou rce = fld.Name End If Next Next
End Sub
Are you working from within Access? If so, for one thing, you've got the
driver - it came with Access. For another thing, you might want to consider
using DAO instead of ADO. I'm not saying it's compelling one way or the
other, but when I'm using an Access front-end to an Access back-end, I
generally stick to DAO because that's what Access is doing natively anyway.
The Recordset property of a normal bound form, for instance, will give you a
DAO recordset.
Next, if you do want an ADO connection to the current database, you need look
no farther than CurrentProject. Connection. You can also look at that to see
the connection string format for connecting to any JET database.
On Sat, 24 Jan 2004 14:44:05 GMT, "MNC" <no****@nospam. nospam> wrote: Thank you for the detailed explanation. I can easily remove the BatchOptimisti c as I don't really need that: it just slipped in as part of me trying to get this going.
As for the first, you are in fact correct: I am connecting using the MS ODBC Driver for Access. I'm learning how to do this by applying general principles I learned over the years, and the help file: all the references I find pretty much assume the use of some ODBC driver or another. Where do I find/install the Access ADO driver?
"Steve Jorgensen" <no****@nospam. nospam> wrote in message news:ls******* *************** **********@4ax. com... Access will allow you to bind a recordset to a form at run-time, but it's not very happy unless the recordset was opened using using the standard Access ADO driver, either directly or as a wrapper around the SQL Server provider. It looks to me like you are using the ODBC provider, and Access form's (as of Access 2002) don't deal with that where editing is concerned.
Now, for the next problem. Access does not play well with BatchOptimistic ADO recordsets. It will let you "edit" them, but somehow, Access reaches underneath the recordset and writes directly to the underlying values instead of the updated values. This is completely broken behavior because, not only has the value change -not- been recorded, but the supposedly pristine record of the original state has been overwritten, so it appears that the back-end data has been changed by another user since the edit began.
For all I know, this may all have changed in Access 2003, but I haven't heard one way or the other. ADO in Access doesn't seem to have caught on enough for there to be many folks out there reporting on what has or hasn't improved in this regard, and I haven't gotten around to checking it out myself.
On Fri, 23 Jan 2004 22:47:04 GMT, "MNC" <HT****@rogers. com> wrote:
>I'm using Access2002, and can't seem to get an updateable recordset going >:-( > >What am I doing wrong, here's the code. The form's controls are notlocked, >the recordset type is Dynaset (changing to Dynaset inconsistent updatesdoes >not work), I'm allowing edits, and I'm at a loss ... > >Please help! > >Option Compare Database >Public rstMember As New Recordset >Public cntConn1 As New Connection >Public cmd As New Command > > >Private Sub Form_Close() > rstMember.Close > cntConn1.Close > > Set rstMember = Nothing > Set cntConn1 = Nothing > Set cmd = Nothing > >End Sub > >Private Sub Form_Load() > >Dim i As Integer >Dim cntl As Control >Dim fld As Field > > >'Specify the connect string > cntConn1.Connec tionString = "DSN=test;uid=a dmin;pwd=" >'Open the connection > cntConn1.Open > >'Specify the SQL statement > cmd.ActiveConne ction = cntConn1 > cmd.CommandText = "SELECT LName FROM tblMemberInfo" > > >'Open the recordset > rstMember.Curso rLocation = adUseClient > rstMember.Open cmd, , adOpenStatic, adLockBatchOpti mistic, adCmdText > Me.UniqueTable = "tblMemberI nfo" > > Set Me.Recordset = rstMember > For Each fld In rstMember.Field s > For Each cntl In Me.Controls > If cntl.Name = fld.Name Then > cntl.ControlSou rce = fld.Name > End If > Next > Next > >End Sub > This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: jason |
last post by:
I am picking up the following error message which is strange as it has only
started happening since I have transferred servers:
Microsoft JET Database Engine error '80004005' Operation must use an
updateable query./admin/news1.asp, line 59
sql1 = "INSERT INTO
(strDate,Department,Title,ShortDescription,strContent) VALUES (" & strDate1
|
by: Robert Mark Bram |
last post by:
Hi All!
I have the following two methods in an asp/jscript page - my problem is that
without the update statement there is no error, but with the update
statement I get the following error:
Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
Syntax error in UPDATE statement.
/polyprint/dataEntry.asp, line 158
|
by: ren |
last post by:
Hello,
When I open with Access 2000 a .DBF table and try to modify the content of a
(random) record, I get the message 'This recordset is not updateable". And
indeed, I can't change the content nor delete it.
However, when opening the same .DBF tabel with Access 2000, though installed
on another computer, I can change the content or...
|
by: TC |
last post by:
Folks
Is there >>ANY<< way to get the actual text of an error that is trapped by
the Form_Error event?
I mean actual text like: "duplicate record in table XYZ", not template text
like: "duplicate record in table |1".
I need this for a general purpose error handler. I've tried everything
obvious, including err.description, the...
|
by: dixie |
last post by:
I have a form full of subforms which bring summary information onto the form
from about 12 different tables. I am trying to get all of that summary
information (mainly numbers) into 1 large table that represents the final
results for the year. The table into which I wish to save it has 10
records, the past 10 years results. The problem is...
| |
by: jm |
last post by:
I have a simple query. It has two tables. If I open the tables
separately, I can add records. If I open them up together, the
recordset is not updateable. As best I know, this has never been a
problem it just happened all of a sudden.
- The database has been repaired and converted several times to no
avail.
- All the permissions are...
|
by: MGFoster |
last post by:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
I want the recordset (rs) in the following function to be updateable.
How do I do it?
Even though the code is VBA I will be translating to VBS for a MS SQL
Server DTS package. That I know how to do. I just don't know how to
open the Connection and/or Recordset so I can change the SQL WHERE...
|
by: dd_bdlm |
last post by:
Please help this one is driving me mad! I have searched and read all
the topics on the error message I am receiving but none seem to apply
to me!
I have quite a complex query linking all parts of my database together
doing final calculations etc. This query when run (through the form)
comes up with 'this recordset is not updateable' error....
|
by: Sim Zacks |
last post by:
I have a postgresql backend with an access front end and I am trying to
redefine the recordset of the form to use an ADO recordset. The problem is
that the CursorType always changes to AdOpenStatic, even if I choose
adOpenDynamic. If anyone has any thoughts, please let me know. The form
works great for viewing, but I cannot update or insert...
|
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...
|
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. ...
| |
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...
|
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...
|
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...
|
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...
|
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...
|
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.
| |