|
 |
access thread: form read only...
Message #1 by "Darin Wray" <darin@r...> on Thu, 6 Dec 2001 23:38:47
|
|
Hey guys...
what i'm doing here is populating a form based on this sql statement that
is executed from a command button. the form populates just fine, but for
some reason, i can't edit any records. I've set the unique table property
correctly in the form that it's calling...and, when i open up the form by
itself, and assign it a recordsource directly, i have no problems doing
any editing at all. problem is when i run this code. is there a value or
setting i'm missing somewhere? or should this be done another way?
ive tried using a stored procedure to populate the form...with a
paramater. but, i haven't figured out how to pass the value i want for
the parameter from vb code. still messing with that too...
darin
Private Sub Command5_Click()
Dim mydb As ADODB.Connection
Dim rst As ADODB.Recordset
Dim strcnn As String
Dim sSql As String
sSql = "SELECT dbo.tblInvoice.FirstName, dbo.tblInvoice.LastName,
dbo.tblInvoice.Date, dbo.tblInvoice.SalesRep, dbo.tblInvoice.OfficeID,
dbo.tblInvoice.ManagerID, dbo.tblRates.RateCode, dbo.tblRates.RatePrice,
dbo.tblRates.MobileNumber, dbo.tblRates.ContactNumber,
dbo.tblRates.RateType, dbo.tblRates.Card, dbo.tblRates.OneWeek,
dbo.tblRates.OneMonth, dbo.tblRates.ThreeMonth"
sSql = sSql & " FROM dbo.tblInvoice INNER JOIN dbo.tblRates ON
dbo.tblInvoice.InvoiceID = dbo.tblRates.InvoiceID "
sSql = sSql & "WHERE dbo.tblInvoice.OfficeID = '" & Me.cboOffice & "'"
strcnn = "Provider=sqloledb;" & _
"Data Source=111.111.111.111;Initial Catalog=x;User
Id=xx;Password=xxxxxxx; "
Set mydb = New ADODB.Connection
mydb.Open strcnn
Set rst = New ADODB.Recordset
rst.Open sSql, mydb, adOpenKeyset, adLockOptimistic
DoCmd.OpenForm "fsubFollowup", acFormDS, , , , acHidden
With Forms("fsubFollowup")
Set .Recordset = rst
.Visible = True
End With
'Set rst = Nothing
'Set db = Nothing
End Sub
Message #2 by Lonnie Johnson <prodevmg@y...> on Thu, 6 Dec 2001 21:19:23 -0800 (PST)
|
|
--0-1327141770-1007702363=:75220
Content-Type: text/plain; charset=us-ascii
Does the SQL statement...
1. join with another table?
If so, the recordset may not be updateable because of the particular cascading affect the relationship may be causing..
2. Or does it create "Unique" records or rows (SELECT DISTINCT)?
If so, this is not updateable because a row or record could actually represent two actual records in the table.
Just a couple of thoughts
Darin Wray <darin@r...> wrote: Hey guys...
what i'm doing here is populating a form based on this sql statement that
is executed from a command button. the form populates just fine, but for
some reason, i can't edit any records. I've set the unique table property
correctly in the form that it's calling...and, when i open up the form by
itself, and assign it a recordsource directly, i have no problems doing
any editing at all. problem is when i run this code. is there a value or
setting i'm missing somewhere? or should this be done another way?
ive tried using a stored procedure to populate the form...with a
paramater. but, i haven't figured out how to pass the value i want for
the parameter from vb code. still messing with that too...
darin
Private Sub Command5_Click()
Dim mydb As ADODB.Connection
Dim rst As ADODB.Recordset
Dim strcnn As String
Dim sSql As String
sSql = "SELECT dbo.tblInvoice.FirstName, dbo.tblInvoice.LastName,
dbo.tblInvoice.Date, dbo.tblInvoice.SalesRep, dbo.tblInvoice.OfficeID,
dbo.tblInvoice.ManagerID, dbo.tblRates.RateCode, dbo.tblRates.RatePrice,
dbo.tblRates.MobileNumber, dbo.tblRates.ContactNumber,
dbo.tblRates.RateType, dbo.tblRates.Card, dbo.tblRates.OneWeek,
dbo.tblRates.OneMonth, dbo.tblRates.ThreeMonth"
sSql = sSql & " FROM dbo.tblInvoice INNER JOIN dbo.tblRates ON
dbo.tblInvoice.InvoiceID = dbo.tblRates.InvoiceID "
sSql = sSql & "WHERE dbo.tblInvoice.OfficeID = '" & Me.cboOffice & "'"
strcnn = "Provider=sqloledb;" & _
"Data Source=111.111.111.111;Initial Catalog=x;User
Id=xx;Password=xxxxxxx; "
Set mydb = New ADODB.Connection
mydb.Open strcnn
Set rst = New ADODB.Recordset
rst.Open sSql, mydb, adOpenKeyset, adLockOptimistic
DoCmd.OpenForm "fsubFollowup", acFormDS, , , , acHidden
With Forms("fsubFollowup")
Set .Recordset = rst
.Visible = True
End With
'Set rst = Nothing
'Set db = Nothing
End Sub
---------------------------------
Do You Yahoo!?
Send your FREE holiday greetings online at Yahoo! Greetings.
Message #3 by "Darin Wray" <darin@r...> on Fri, 7 Dec 2001 08:45:29 -0600
|
|
This is a multi-part message in MIME format.
------=_NextPart_000_006C_01C17EFB.85F065A0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
well, the sql statement you see is basically the same i used in a stored
procedure with a parameter. with the code below, in the where statement
i'm trying to pass the value i want to filter the recordset. like i
said, it works fine...just can't update the table i want :) there are
2 tables joined together. now, when i use the stored procedure...which
as i said is basically the same as the statement below...for the
recordsource of the form, i have no problems updating the records. and,
i'd just use the stored procedure, if i could figure out how to pass the
parameter in code...my eyes are bleeding from trying to find a good
example in one of my books..hehe
darin
----- Original Message -----
From: Lonnie Johnson
To: Access
Sent: Thursday, December 06, 2001 11:19 PM
Subject: [access] Re: form read only...
Does the SQL statement...
1. join with another table?
If so, the recordset may not be updateable because of the
particular cascading affect the relationship may be causing..
2. Or does it create "Unique" reco rds or rows (SELECT DISTINCT)?
If so, this is not updateable because a row or record could
actually represent two actual records in the table.
Just a couple of thoughts
Darin Wray <darin@r...> wrote:
Hey guys...
what i'm doing here is populating a form based on this sql statement
that
is executed from a command button. the form populates just fine, but
for
some reason, i can't edit any records. I've set the unique table
property
correctly in the form that it's calling...and, when i open up the
form by
itself, and assign it a recordsource directly, i have no problems
doing
any editing at a ll. problem is when i run this code. is there a
value or
setting i'm missing somewhere? or should this be done another way?
ive tried using a stored procedure to populate the form...with a
paramater. but, i haven't figured out how to pass the value i want
for
the parameter from vb code. still messing with that too...
darin
Private Sub Command5_Click()
Dim mydb As ADODB.Connection
Dim rst As ADODB.Recordset
Dim strcnn As String
Dim sSql As String
sSql =3D "SELECT dbo.tblInvoice.FirstName, dbo.tblInvoice.LastName,
dbo.tblInvoice.Date, dbo.tblInvoice.SalesRep,
dbo.tblInvoice.OfficeID,
dbo.tblInvoice.ManagerID, dbo.tblRates.RateCode,
dbo.tblRates.RatePrice,
dbo.tblRates.Mobi leNumber, dbo.tblRates.ContactNumber,
dbo.tblRates.RateType, dbo.tblRates.Card, dbo.tblRates.OneWeek,
dbo.tblRates.OneMonth, dbo.tblRates.ThreeMonth"
sSql =3D sSql & " FROM dbo.tblInvoice INNER JOIN dbo.tblRates ON
dbo.tblInvoice.Invoic eID =3D dbo.tblRates.InvoiceID "
sSql =3D sSql & "WHERE dbo.tblInvoice.OfficeID =3D '" & Me.cboOffice
& "'"
strcnn =3D "Provider=3Dsqloledb;" & _
"Data Source=3D111.111.111.111;Initial Catalog=3Dx;User
Id=3Dxx;Password=3Dxxxxxxx; "
Set mydb =3D New ADODB.Connection
mydb.Open strcnn
Set rst =3D New ADODB.Recordset
rst.Open sSql, mydb, adOpenKeyset, adLockOptimistic
DoCmd.OpenForm "fsubFollowup", acFormDS, , , , acHidden
With Forms("fsubFollowup")Set .Recordset =3D rst
.Visible =3D True
End With
'Set rst =3D Nothing
'Set db =3D Nothing
End Sub
to unsubscribe send a blank email to leave-access-648085Q@p...
ox.com.
-------------------------------------------------------------------------
-----
Do You Yahoo!?
Send your FREE holiday greetings online at Yahoo! Greetings. ---
Change your mail options at http://p2p.wrox.com/manager.asp or to
unsubscribe send a blank email to $subst('Email.Unsub').
|
|
 |