473,386 Members | 1,738 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.

Editable Views (Queries)

In MS Access 2000 I am developing a form for editing and viewing the
combined data from half a dozen tables. When I include all but one of the
tables in the source query for the form, everything is fine and I can edit
all of the desired fields. However, when I include the last table the query
suddenly appears to become read-only, and I can no longer edit fields from
any of the tables.

The join criteria for this last table are different from the others as
follows:

1) A left outer join must be used when adding this final table because it
does not include rows corresponding to some of the rows in the other tables,
and all of the rows from the other tables are required in the result set.

2) The join criteria for the last table involves comparing a couple of its
columns to substrings of a column in one of the other tables, i.e.:
where county.country_id=well.country.id and
county.state_api=mid(well.api,1,2) and county.county_api=mid(well.api,3,3)

Can anyone confirm whether one or both of the above ideosyncracies will
force a query to become read-only as the source for a form?

Can anyone point me to some documentation that describes the exact
circumstances under which a query will become read-only as the source for a
form?

Finally, assuming that one of the above issues does in fact force the source
query to become read only, can anyone suggest a reasonable work-around?
Please note that the database structure is supplied by a third party, and
cannot be changed. All I can do is change the the form or its source query.
Note that the only reason for joining to this particular table is to
*display* the value of a single column from that table. This particular
value does *not* need to be edited. However, I am very new at Access form
development, and haven't yet figured out any way that I can display the
column values from this last table on the form without including that table
in my source query, and thus hitting the apparant read-only query problem.

Thanks in advance for any help.

s/KAM

Nov 13 '05 #1
5 1538
rkc

"Kevin Myers" <Ke********@austin.rr.com> wrote in message
news:10*************@corp.supernews.com...
In MS Access 2000 I am developing a form for editing and viewing the
combined data from half a dozen tables. When I include all but one of the
tables in the source query for the form, everything is fine and I can edit
all of the desired fields. However, when I include the last table the query suddenly appears to become read-only, and I can no longer edit fields from
any of the tables.

The join criteria for this last table are different from the others as
follows:

1) A left outer join must be used when adding this final table because it
does not include rows corresponding to some of the rows in the other tables, and all of the rows from the other tables are required in the result set.

2) The join criteria for the last table involves comparing a couple of its
columns to substrings of a column in one of the other tables, i.e.:
where county.country_id=well.country.id and
county.state_api=mid(well.api,1,2) and county.county_api=mid(well.api,3,3)

Can anyone confirm whether one or both of the above ideosyncracies will
force a query to become read-only as the source for a form?

Can anyone point me to some documentation that describes the exact
circumstances under which a query will become read-only as the source for a form?

Finally, assuming that one of the above issues does in fact force the source query to become read only, can anyone suggest a reasonable work-around?
Please note that the database structure is supplied by a third party, and
cannot be changed. All I can do is change the the form or its source query. Note that the only reason for joining to this particular table is to
*display* the value of a single column from that table. This particular
value does *not* need to be edited. However, I am very new at Access form
development, and haven't yet figured out any way that I can display the
column values from this last table on the form without including that table in my source query, and thus hitting the apparant read-only query problem.


There are at least two ways I can think of to display the troublesome field
on the form without including it in the recordsource. One is to simply look
it up in the OnCurrent event of the form using the same criteria you would
if included in the query. Two, it may be possible to include the field as a
subform linked to the main form. You can format a subform to look like
nothing more than another textbox control easy enough.



Nov 13 '05 #2
Please see below...

"rkc" <rk*@yabba.dabba.do.rochester.rr.bomb> wrote in message
news:np********************@twister.nyroc.rr.com.. .

<snip>
There are at least two ways I can think of to display the troublesome field on the form without including it in the recordsource. One is to simply look it up in the OnCurrent event of the form using the same criteria you would
if included in the query. Two, it may be possible to include the field as a subform linked to the main form. You can format a subform to look like
nothing more than another textbox control easy enough.


Thanks very much for this information. Can you please elaborate further on
how to use the OnCurrent event for this purpose? I am already supplying
some code in the Form_Current event handler, and I know how to assign a
value to a text box so that it can be displayed. What I don't know is how
to obtain the desired value from within this method. The required SQL would
look something like this:

select county_name from county
where county.country_id=well.country_id and
county.state_API=val(mid(well.API,1,2)) and
county.county_API=val(mid(well.API,3,3));

Problems:

1. From within Form_Current, how can I bind this query to my form such that
the values from the well table correspond to the record that is presently
displayed on my form (which comes from a joined query that includes the well
table)?

2. How can I execute this query from within Form_Current?

3. How can I extract the desired value from the result of the query so that
I can shove the value into my text box for display?

Thanks again,
s/KAM

Nov 13 '05 #3
rkc

"Kevin Myers" <Ke********@austin.rr.com> wrote in message
news:10*************@corp.supernews.com...
Please see below...

"rkc" <rk*@yabba.dabba.do.rochester.rr.bomb> wrote in message
news:np********************@twister.nyroc.rr.com.. .

<snip>
There are at least two ways I can think of to display the troublesome field
on the form without including it in the recordsource. One is to simply

look
it up in the OnCurrent event of the form using the same criteria you would if included in the query. Two, it may be possible to include the field

as a
subform linked to the main form. You can format a subform to look like
nothing more than another textbox control easy enough.
Thanks very much for this information. Can you please elaborate further

on how to use the OnCurrent event for this purpose? I am already supplying
some code in the Form_Current event handler, and I know how to assign a
value to a text box so that it can be displayed. What I don't know is how
to obtain the desired value from within this method. The required SQL would look something like this:

select county_name from county
where county.country_id=well.country_id and
county.state_API=val(mid(well.API,1,2)) and
county.county_API=val(mid(well.API,3,3));

Problems:

1. From within Form_Current, how can I bind this query to my form such that the values from the well table correspond to the record that is presently
displayed on my form (which comes from a joined query that includes the well table)?

2. How can I execute this query from within Form_Current?

3. How can I extract the desired value from the result of the query so that I can shove the value into my text box for display?


I suppose you could try and shove that criteria into a DLookup and make that
the Control Source property of the textbox for display.

What I would probably do is open a recordset based on that query in the
OnCurrent event of the form and set the textbox value to the result of the
recordset. Example aircode (no error handling) would be:

dim rs as dao.recordset
dim sql as string
sql = "select county_name from county " & _
"where county.country_id=well.country_id " & _
"and " & _
"county.state_API=val(mid(well.API,1,2)) " & _
"and " & _
"county.county_API=val(mid(well.API,3,3));"

set rs = currentdb.openrecordset (sql)
with rs
if not .eof then
txtCounty_Name = .Fields("county_name") & vbNullString
end if
end with

rs.close
set rs = nothing

Nov 13 '05 #4
rkc

"rkc" <rk*@yabba.dabba.do.rochester.rr.bomb> wrote in message
news:ij********************@twister.nyroc.rr.com.. .
sql = "select county_name from county " & _
"where county.country_id=well.country_id " & _
"and " & _
"county.state_API=val(mid(well.API,1,2)) " & _
"and " & _
"county.county_API=val(mid(well.API,3,3));"


oops. Lame cut&paste job.
The sql string ,using the control values, would be more like:

"select county_name from county where " & _
"county.country_id= " & _
me!country_id & _
"and county.state_API= " & _
val(mid(me!API,1,2)) & _
"and county!county_API= " & _
val(mid(me!API,3,3)) & ";"


Nov 13 '05 #5
Managed to get this working based on DLookup. I'd have never found that
function without your help. Thanks!

s/KAM
"rkc" <rk*@yabba.dabba.do.rochester.rr.bomb> wrote in message
news:Ls*******************@twister.nyroc.rr.com...

"rkc" <rk*@yabba.dabba.do.rochester.rr.bomb> wrote in message
news:ij********************@twister.nyroc.rr.com.. .
sql = "select county_name from county " & _
"where county.country_id=well.country_id " & _
"and " & _
"county.state_API=val(mid(well.API,1,2)) " & _
"and " & _
"county.county_API=val(mid(well.API,3,3));"


oops. Lame cut&paste job.
The sql string ,using the control values, would be more like:

"select county_name from county where " & _
"county.country_id= " & _
me!country_id & _
"and county.state_API= " & _
val(mid(me!API,1,2)) & _
"and county!county_API= " & _
val(mid(me!API,3,3)) & ";"

Nov 13 '05 #6

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

Similar topics

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...
8
by: Mike N. | last post by:
Hello: I am new to T-SQL programing, and relativly new to SQL statements in general, although I have a good understanding of database theory. I'm a little confused as to the fundamental...
1
by: Eric Bragas | last post by:
I read somewhere that views (and queries) execute on client machines while stored procedures execute on the server. Is this correct?
3
by: KemperR | last post by:
Hello Experts outhere, may be someone can tell me whats going wrong with my ADOX trial. I have an Access 2002 database with some tables and queries (views) The code listed below works well up...
5
by: Jerry Hull | last post by:
I'm working with a database developed by an untrained person over several years - and on a network that has recently been upgraded with a new server installed and MS office upgraded from 2K (I...
2
by: Aaron Haspel | last post by:
Greetings Access gurus. I have clients with Access databases in the field that I need to update -- new tables, new indices, new queries, the works. Since these clients may have only the Access...
1
by: loosecannon_1 | last post by:
Hello everyone, I am hoping someone can help me with this problem. I will say up front that I am not a SQL Server DBA, I am a developer. I have an application that sends about 25 simultaneous...
28
by: mooreit | last post by:
The purpose for my questions is accessing these technologies from applications. I develop both applications and databases. Working with Microsoft C#.NET and Microsoft SQL Server 2000 Production and...
1
pbmods
by: pbmods | last post by:
Today I'd like to talk about a new feature introduced in MySQL 5: Views. Views are like snapshots of queries. You can save any query as a view, even complex queries with joins and subqueries,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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.