473,657 Members | 2,486 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

DoCmd.OpenView error

Hi
I'm using Command

DoCmd.OpenView "dbo.vFDXQryBld gEdit3",acViewN ormal,acEdit

to open a view vFDXQryBldgEdit 3 (written in SQL Server) in the Edit
mode. This view is created on single table. but when I eecute this
command view is opened in Read only mode.
Am i missing something here or this command does not works in MS Access
..adp applications.

I'm using Access 2003 and SQL Server for Backend database.

Thanks for any suggestions anyone has.

Nov 14 '06 #1
10 4547
On 14 Nov 2006 09:30:06 -0800, "Shals" <s_******@berke ley.eduwrote:

Perhaps there is no Primary Key on the underlying table?
-Tom.

>Hi
I'm using Command

DoCmd.OpenVi ew "dbo.vFDXQryBld gEdit3",acViewN ormal,acEdit

to open a view vFDXQryBldgEdit 3 (written in SQL Server) in the Edit
mode. This view is created on single table. but when I eecute this
command view is opened in Read only mode.
Am i missing something here or this command does not works in MS Access
.adp applications.

I'm using Access 2003 and SQL Server for Backend database.

Thanks for any suggestions anyone has.
Nov 14 '06 #2
there is a Primary Key on that table but still it doesn't work.
Tom van Stiphout wrote:
On 14 Nov 2006 09:30:06 -0800, "Shals" <s_******@berke ley.eduwrote:

Perhaps there is no Primary Key on the underlying table?
-Tom.

Hi
I'm using Command

DoCmd.OpenView "dbo.vFDXQryBld gEdit3",acViewN ormal,acEdit

to open a view vFDXQryBldgEdit 3 (written in SQL Server) in the Edit
mode. This view is created on single table. but when I eecute this
command view is opened in Read only mode.
Am i missing something here or this command does not works in MS Access
.adp applications.

I'm using Access 2003 and SQL Server for Backend database.

Thanks for any suggestions anyone has.
Nov 15 '06 #3
Any other Suggestions Please !!!
Shals wrote:
there is a Primary Key on that table but still it doesn't work.
Tom van Stiphout wrote:
On 14 Nov 2006 09:30:06 -0800, "Shals" <s_******@berke ley.eduwrote:

Perhaps there is no Primary Key on the underlying table?
-Tom.

>Hi
>I'm using Command
>
>DoCmd.OpenVi ew "dbo.vFDXQryBld gEdit3",acViewN ormal,acEdit
>
>to open a view vFDXQryBldgEdit 3 (written in SQL Server) in the Edit
>mode. This view is created on single table. but when I eecute this
>command view is opened in Read only mode.
>Am i missing something here or this command does not works in MS Access
>.adp applications.
>
>I'm using Access 2003 and SQL Server for Backend database.
>
>Thanks for any suggestions anyone has.
Nov 16 '06 #4
"Shals" <s_******@berke ley.eduwrote in
news:11******** *************@k 70g2000cwa.goog legroups.com:
Any other Suggestions Please !!!
Yes, this command works in an Access ADP.

Does the user have update etc permissions on the view/table?

Can you post a CREATE VIEW SQL string for the VIEW?

What happens with
DoCmd.OpenTable "TheUnderlyingT able", acViewNormal, acEdit
Is that editable?

Are you using Application Roles?
--
Lyle Fairfield

from http://msdn.microsoft.com/library/de...l=/library/en-
us/dnmdac/html/data_mdacroadma p.asp

Obsolete Data Access Technologies
Obsolete technologies are technologies that have not been enhanced or
updated in several product releases and that will be excluded from future
product releases. Do not use these technologies when you write new
applications. When you modify existing applications that are written using
these technologies, consider migrating those applications to ADO.NET.
The following components are considered obsolete:
....
Data Access Objects (DAO): DAO provides access to JET (Access) databases.
This API can be used from Microsoft Visual Basic®, Microsoft Visual C++®,
and scripting languages. It was included with Microsoft Office 2000 and
Office XP. DAO 3.6 is the final version of this technology. It will not be
available on the 64-bit Windows operating system.
.....
Nov 17 '06 #5
Thanks for your input,

Here is the code for the view:

SELECT DISTINCT
TOP 100 PERCENT BuildingNumber, BuildingName,
YearConstructed , ConditionCode, DATEPART(yy, GETDATE()) -
YearConstructed AS age,
YearLatestImpro vement
FROM dbo.Buildings
WHERE (ConditionCode = '1') AND (DATEPART(yy, GETDATE()) -
YearConstructed 5)
ORDER BY BuildingNumber
Well I checked for Docmd.OpenTable on the Table Buildings it shows
editable datasheet and I can modify it but somehow its not showing
editable view on same table for which I have given the code.

I'm using Database roles not application roles. also I have given
permission for table as well as view for Insert, Update, Delete but no
luck in getting view editable.

please can you see if there is anything in the code. Thanks for all
your help

Lyle Fairfield wrote:
"Shals" <s_******@berke ley.eduwrote in
news:11******** *************@k 70g2000cwa.goog legroups.com:
Any other Suggestions Please !!!

Yes, this command works in an Access ADP.

Does the user have update etc permissions on the view/table?

Can you post a CREATE VIEW SQL string for the VIEW?

What happens with
DoCmd.OpenTable "TheUnderlyingT able", acViewNormal, acEdit
Is that editable?

Are you using Application Roles?
--
Lyle Fairfield

from http://msdn.microsoft.com/library/de...l=/library/en-
us/dnmdac/html/data_mdacroadma p.asp

Obsolete Data Access Technologies
Obsolete technologies are technologies that have not been enhanced or
updated in several product releases and that will be excluded from future
product releases. Do not use these technologies when you write new
applications. When you modify existing applications that are written using
these technologies, consider migrating those applications to ADO.NET.
The following components are considered obsolete:
...
Data Access Objects (DAO): DAO provides access to JET (Access) databases.
This API can be used from Microsoft Visual Basic®, Microsoft Visual C++®,
and scripting languages. It was included with Microsoft Office 2000 and
Office XP. DAO 3.6 is the final version of this technology. It will not be
available on the 64-bit Windows operating system.
....
Nov 17 '06 #6
Shals wrote:
Here is the code for the view:

SELECT DISTINCT
TTBOMK Views whose definition contains DISTINCT are not updateable.

As you have indicated that the table has a primary index (on Building
Number?) DISTINCT should be unnecessary.
Nov 17 '06 #7
Thanks a lot Lyle,

Without your help I would have never got that error corrected.
its working now :-)

If you can help me in one more error. I would be very thankful to you.

the problem is I have a Main Form and Sub Form within that Main Form.
The subform is linked through master and Child Fields with the Main
Form.

The Main Form is getting data from Buildings Table which has Primary
Key BuildingNumber and sub form is getting data from another table
BldgFloor which has Primary Key BuildingNumber and FloorLevel.

now when I click a button to open the main form it opens correctly but
when I focus from subform back to main form it throws an error

"Subquery returned more than 1 value.This is not permitted when
subquery follows =,!=,<,<=,>,>= or when subquery is used as an
expression."

I tried recreating the Master and CHild linked fields, as well as I
tried recreating the form again but no luck same error persists.

The strange thing is I have same structure database with some other
name but some what different data records in it. when I connect my adp
application to that database it doesn't gives that error and then when
I reconnect it back to same database it gives the error.

I tried checking the foreign key constraint on the tables and verified
the data but it doesn't looks bad. Also this error is not coming while
debugging the application in VBA code but comes just after that.

I have no idea whats going on. If you can suggest some things I can try
that, please let me know.

Thanks again for all your help.
Lyle Fairfield wrote:
Shals wrote:
Here is the code for the view:

SELECT DISTINCT

TTBOMK Views whose definition contains DISTINCT are not updateable.

As you have indicated that the table has a primary index (on Building
Number?) DISTINCT should be unnecessary.
Nov 17 '06 #8
Shals wrote:
"Subquery returned more than 1 value.This is not permitted when
subquery follows =,!=,<,<=,>,>= or when subquery is used as an
expression."
I created this error:

ALTER PROCEDURE tmpProc AS
DECLARE @DivisionName varchar(255)
SELECT @DivisionName = (SELECT fldDivisionName FROM dbo.tblDivision s)
RETURN

There was no error with:

ALTER PROCEDURE tmpProc AS
DECLARE @DivisionName varchar(255)
SELECT @DivisionName = (SELECT fldDivisionName FROM dbo.tblDivision s
WHERE fldDivisionID = 33)
RETURN

As you can see, the subquery in the first SPROC will return more than
one row, and SQL-Server will not know from which row to get the value
of @DivisionName.

In the second SPROC only one row is returned and no error occurs.

Is it possible that in the SQL that surrounds your form or subform you
have such a SPROC. Is it possible that intially only one value is
returned but after you work in the subform two or more values are
returned?

Nov 18 '06 #9
Actually there are no Stored Procedure or Views or Trigger associated
with the Main form or Sub form they both are getting values from tables
directly attached through the RecordSources Property.

the only other field I'm calculating is the sum total of all the
records that are in the subform datasheet.
there is no other code attached with the forms.

Lyle Fairfield wrote:
Shals wrote:
"Subquery returned more than 1 value.This is not permitted when
subquery follows =,!=,<,<=,>,>= or when subquery is used as an
expression."

I created this error:

ALTER PROCEDURE tmpProc AS
DECLARE @DivisionName varchar(255)
SELECT @DivisionName = (SELECT fldDivisionName FROM dbo.tblDivision s)
RETURN

There was no error with:

ALTER PROCEDURE tmpProc AS
DECLARE @DivisionName varchar(255)
SELECT @DivisionName = (SELECT fldDivisionName FROM dbo.tblDivision s
WHERE fldDivisionID = 33)
RETURN

As you can see, the subquery in the first SPROC will return more than
one row, and SQL-Server will not know from which row to get the value
of @DivisionName.

In the second SPROC only one row is returned and no error occurs.

Is it possible that in the SQL that surrounds your form or subform you
have such a SPROC. Is it possible that intially only one value is
returned but after you work in the subform two or more values are
returned?
Nov 18 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
17229
by: jj | last post by:
I've got a form button that fires off 3 queries but if the first query returns an error, I don't want the other two queries to happen. Example: first query runs an insert from a linked table but if for some reason a field is missing a value that's required, Access throws up an error. At that point I just want to end the process and notify them of the error so they can correct the data and try the process again. Here's my code:
3
11058
by: user_5701 | last post by:
Hello, I'm getting an error with a Docmd.Transferspreadsheet line of code: DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel2000, "tblTest", pathAndFilename, True The above line works perfectly fine, but when I change the table name argument (tblTest) to the name of a query, it fails and gives the following error:
6
8451
by: Squirrel | last post by:
I have a command button on a subform to delete a record. The only statement in the subroutine is: DoCmd.RunCommand acCmdDeleteRecord The subform's recordsource is "select * from tblVisit order by VisitDt" I'm getting this error message: Errno is 2465. Err.description is "Can't find field '|' referred to in your expression"
4
3438
by: WJA | last post by:
I'm probably missing something here but I can't understand the following. When 2 users try to save a record with the same primary key (a number field), the first record saves as expected, but the second does not produce an error. The "Save" button uses "Docmd.Save" to save the record. If I insert "Me.Dirty = False" before "Docmd.Save" an error is produced. Why doesn't "Docmd.Save" produce an error but instead silently fails to save the...
1
5315
by: Ryan | last post by:
Hello. I was hoping that someone may be able to assist with an issue that I am experiencing. I have created an Access DB which imports an Excel File with a particular layout and field naming. Next the user can go into a Form which basically a dynamic query with a friendly interface that eventually outputs a table that is stored in the DB as well as exported to a CSV file. The CSV file is then used with a vendor solution to fill in...
4
13466
by: RAG2007 | last post by:
Hi Having some problems with docmd.findrecord, getting runtime error 2162, in an adp, sql server back end. On my main form, I have a continuous view subform giving a list of subrecords within the main record. Double clicking on the subrecord changes the subform to a form that gives more detailed information on that specific subrecord. I've been trying to use docmd.findrecord to pull up the info, but I'm getting nowhere. Here's my code: ...
0
6601
by: Ben Lahoy | last post by:
Hi! My problem is basically in a search modal window, where the user is allowed to make a selection on which option to take. After selecting an option and then giving the data to search, the user clicks the "OK" button and the user gets taken back to the "Customer" form with the correct searched record. The function works fine except that every now and then it takes 3-5 seconds to close the search modal window and goes back to the...
7
9072
by: surferj | last post by:
Hello, I am trying to run a macro in that was created in an earlier version of access but getting an error message when i try to run it in 2007. The error occurs on the DoCmd.RunMacro "M_Report2007.ConsumerMoSalesR" , 1 line. Below is the VB scripting and error message. not sure if i need to create individual macro modules to be able to complete the commands but any help is appreciated. ERROR: Run-time Error '2501': The RunMacro...
5
4314
by: Lebbsy | last post by:
After displaying search results, I want to be able to double click the identity number field and then the input form SubmissionDetails becomes the display form for the results of the data matching value of the selected identity number. With my code below I get a data type mismatch error. Please help me....... Private Sub IdentityNumber_Click() On Error GoTo IdentityNumber_Click_Err On Error Resume Next If (Form.Dirty) Then ...
0
8305
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,...
0
8726
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7320
agi2029
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...
1
6163
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4151
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...
0
4301
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2726
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1944
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1604
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.