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

Home Posts Topics Members FAQ

Forms bound to SQL Server views

If I have a form bound to a 'local table query' eg a table of contacts with
first and last names, plus a calculated field for the full name:

SELECT ConID, ConFirst, ConLast, ([ConFirst] & [ConLast]) AS ConFull FROM
tblContact

I place all 4 fields as textboxes on the form and after changing 'Smitt' to
'Smith' if I move my cursor to txtFirstName, I find that the full name
changes automatically to reflect the new surname although I have not saved
the record, nor requeried.

Big deal. That's what any Access beginner knows. However if I move the
data to SQL Server and replace the query with a SQL view I no longer get
this behaviour. So now after editing, the textbox shows First='Paul',
Last='Smith', Full='Paul Smitt' and that is obviously silly.

This is not a big surprise since I realize I have retrieved a record from
the server and it has not yet been saved. However, I am surprised to find I
am a bit stuck for a standard solution. I do not want to save the record,
but I would like the changes in one field to be reflected in the other.

What do people do in this pretty standard situation? Thanks for any advice
/ experience you have with this.

Nov 13 '05 #1
6 1590
Marek Ropski wrote:
If I have a form bound to a 'local table query' eg a table of
contacts with first and last names, plus a calculated field for the
full name:
SELECT ConID, ConFirst, ConLast, ([ConFirst] & [ConLast]) AS ConFull
FROM tblContact

I place all 4 fields as textboxes on the form and after changing
'Smitt' to 'Smith' if I move my cursor to txtFirstName, I find that
the full name changes automatically to reflect the new surname
although I have not saved the record, nor requeried.

Big deal. That's what any Access beginner knows. However if I move
the data to SQL Server and replace the query with a SQL view I no
longer get this behaviour. So now after editing, the textbox shows
First='Paul', Last='Smith', Full='Paul Smitt' and that is obviously
silly.
This is not a big surprise since I realize I have retrieved a record
from the server and it has not yet been saved. However, I am
surprised to find I am a bit stuck for a standard solution. I do not
want to save the record, but I would like the changes in one field to
be reflected in the other.
What do people do in this pretty standard situation? Thanks for any
advice / experience you have with this.


If the concatenated expression was being executed on the form itself instead of
in the view then it would update. Just use a TextBox with a ControlSource of..

= [ConFirst] & " " & [ConLast]

--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com
Nov 13 '05 #2
"Rick Brandt" <ri*********@ho tmail.com> wrote in message
news:8E******** ********@newssv r12.news.prodig y.com...
Marek Ropski wrote:
If I have a form bound to a 'local table query' eg a table of
contacts with first and last names, plus a calculated field for the
full name:
SELECT ConID, ConFirst, ConLast, ([ConFirst] & [ConLast]) AS ConFull
FROM tblContact

I place all 4 fields as textboxes on the form and after changing
'Smitt' to 'Smith' if I move my cursor to txtFirstName, I find that
the full name changes automatically to reflect the new surname
although I have not saved the record, nor requeried.

Big deal. That's what any Access beginner knows. However if I move
the data to SQL Server and replace the query with a SQL view I no
longer get this behaviour. So now after editing, the textbox shows
First='Paul', Last='Smith', Full='Paul Smitt' and that is obviously
silly.
This is not a big surprise since I realize I have retrieved a record
from the server and it has not yet been saved. However, I am
surprised to find I am a bit stuck for a standard solution. I do not
want to save the record, but I would like the changes in one field to
be reflected in the other.
What do people do in this pretty standard situation? Thanks for any
advice / experience you have with this.


If the concatenated expression was being executed on the form itself
instead of in the view then it would update. Just use a TextBox with a
ControlSource of..

= [ConFirst] & " " & [ConLast]

--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com

Hi Rick
Thank you for the suggestion. The only drawback with this is that I could
not then use it for a standard search - eg put my cursor in the textbox and
search for names beginning with 'Paul S' - and this is a key textbox which
is used for searching.
I may have to change the controlsource dynamically if a record gets edited,
but the all-Access behaviour is ideally what I would like to mimic.

Nov 13 '05 #3
Marek Ropski wrote:
Hi Rick
Thank you for the suggestion. The only drawback with this is that I
could not then use it for a standard search - eg put my cursor in the
textbox and search for names beginning with 'Paul S' - and this is a
key textbox which is used for searching.
I may have to change the controlsource dynamically if a record gets
edited, but the all-Access behaviour is ideally what I would like to
mimic.


I would provide a method that doesn't rely on the built in "Find" tool. In
the first place "Find" is terribly inefficient againnst an ODBC linked
source as it basically forces a scan of the entire table being searched.
Second since you are applying the search to a calculated field in the view,
then it is even more inefficient. Searches and joins should always go
against raw table fields with indexes on them.

When you move to a Server back end you pretty much have to abandon the built
in search utilities. They are thrown in there for the desktop user running
a small (local) database. For a server back end you have to move to using
SQL solutons as much as possible and get the server to do the work.

Anyway...if you do Refresh against the form you should get the current field
to update.

--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com
Nov 13 '05 #4
"Rick Brandt" <ri*********@ho tmail.com> wrote in message
news:DE******** ********@newssv r11.news.prodig y.com...
Marek Ropski wrote:
Hi Rick
Thank you for the suggestion. The only drawback with this is that I
could not then use it for a standard search - eg put my cursor in the
textbox and search for names beginning with 'Paul S' - and this is a
key textbox which is used for searching.
I may have to change the controlsource dynamically if a record gets
edited, but the all-Access behaviour is ideally what I would like to
mimic.


I would provide a method that doesn't rely on the built in "Find" tool.
In
the first place "Find" is terribly inefficient againnst an ODBC linked
source as it basically forces a scan of the entire table being searched.
Second since you are applying the search to a calculated field in the
view,
then it is even more inefficient. Searches and joins should always go
against raw table fields with indexes on them.

When you move to a Server back end you pretty much have to abandon the
built
in search utilities. They are thrown in there for the desktop user
running
a small (local) database. For a server back end you have to move to using
SQL solutons as much as possible and get the server to do the work.

Anyway...if you do Refresh against the form you should get the current
field
to update.

--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com

Hi Rick
Thanks for those suggestions which do, of course, make sense. In fact, I
simplified the situation to prevent potential readers from being bored rigid
with the actual details. I do have a pretty good idea of how slow the
built-in search functions are with linked tables as it is currently up and
working - but these are only used for 'secondary searching'. So normally to
find a record people use my custom search box which is fast, but I have told
the users that when their search returns a number of records (say about 100)
from the server they can also use these buttons and it isn't too bad on this
small subset. They can actually use my search form to return all 30,000
records and then search on, say, a phone number field and this might take 20
secs - but all my custom searching is almost instant. I could remove the
standard search functionality or write a lot more code to cater for fields
they'll almost never search on - but for the moment everybody seems happy.
Anyway, returning to the immediate problem - using Me.Refresh saves the
record so I can't quite use that, but thanks for the suggestion. Any other
ideas (Rick or anyone else)?
Nov 13 '05 #5
Marek Ropski wrote:
[snip] Anyway, returning to the immediate
problem - using Me.Refresh saves the record so I can't quite use
that, but thanks for the suggestion. Any other ideas (Rick or anyone
else)?


Well the record would have to be saved before "Find" would let the user move
to a different record so I don't see how that's a problem.

--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com
Nov 13 '05 #6
"Rick Brandt" <ri*********@ho tmail.com> wrote in message
news:FF******** *********@newss vr12.news.prodi gy.com...
Marek Ropski wrote:
[snip] Anyway, returning to the immediate
problem - using Me.Refresh saves the record so I can't quite use
that, but thanks for the suggestion. Any other ideas (Rick or anyone
else)?


Well the record would have to be saved before "Find" would let the user
move
to a different record so I don't see how that's a problem.

--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com

Just that I need the full name to be correct after editing the first or last
name - and at this point I may not have finished editing yet. With a local
table the full name is updated but the record is not yet saved so I can
still undo all my changes.
I am considering at the back of my mind the possibility that I will have to
abandon hope of replicating this 'local table' behaviour and perhaps try
something quite different. But in the meantime if any idea occurs...
Thank you for your continued patience.
Nov 13 '05 #7

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

Similar topics

3
16875
by: polytimi8 | last post by:
Hello, I would like to know if it is possible to create a form in Access2000, which would function like a calendar for 8 operating rooms in hospital, showing which hours are those closed for a specific date. For this intersection I would like to be appeared the name of the doctor, the name of the patient and the kind of operation. Furthemore I would like this intersection to be marked in the calendar with a colour, showing that this...
1
334
by: eazycode | last post by:
visit http://www.eazycode.com Introducing a unique product "EazyCode", that can do coding/programming for you at the click of a button, in a matter of seconds. What is EazyCode? EazyCode is a RAD tool that integrates into Visual Studio .NET and helps you develop and maintain front-end GUI of database applications. EazyCode is a powerful code-generation tool that creates ready-to-use database-driven
5
1647
by: PeteCresswell | last post by:
In another thread, somebody ventured the idea that this was possible under A2k's ADP but they did not sound sure of it. Anybody done it? My agenda is to use DAO for work tables bound to forms.
4
2186
by: Lumpierbritches | last post by:
Thank you once again for any and all assistance. I'm building an application that's getting quite bulky due to the number of forms, macros and procedures. I was wondering if there's a way to use 1 (one) unbound form, if all the fields are the same for multiple forms populating them with Queries? I have a makeshif menu form with command buttons and I would like to eliminate all the forms and replace them with one unbound form for three...
19
4091
by: James Fortune | last post by:
I have a lot of respect for David Fenton and Allen Browne, but I don't understand why people who know how to write code to completely replace a front end do not write something that will automate the code that implements managing unbound controls on forms given the superior performance of unbound controls in a client/server environment. I can easily understand a newbie using bound controls or someone with a tight deadline. I guess I need...
0
1975
by: jon | last post by:
Using Visual C++ and MFC, one could generate a very nice MMI using CFormView and the method detailed in the MSDN "vswap" example to allow multiple forms to be viewed ( switched to ) within a single application ( i.e. a single app running and a single window). A very useful method indeed - very rapid to develop, forms designed at design time, all forms encapsulated within one window, SDI, only one task on taskbar etc... Now, i know...
7
2732
by: Jeff | last post by:
I plan to write a Windows Forms MDI application for a medical office. Users must be able to select a patient and view related information on multiple forms; with1-4 forms opened at the same time for the same patient; each form showing a different type of patient-related information. After viewing information for one patient (say on 3 forms opened simultaneously), users want the ability to select another patient. Upon selection of another...
1
2265
by: TGEAR | last post by:
I am using MS SQL Server management studio. I treid to see some system tables which are sysobjects, syscolumns, systypes, etc.., but i don't see the list under the system tables folder. There is one table showing, sysdiagrams; however, I was able to query sql stmts though. where are they located? or Do I need to contact a dba to release those tables? thanks.
0
1376
by: vimalkanth | last post by:
Hi, We have a Delphi 5 Windows application which is built as a Client- Designer-Server application with http-based data exchange between Client/Designer and Server. Client application is installed in multiple end users machine. Designer and Server (built as ISAPI dll in Delphi) reside in Web Server (IIS). Client and Designer application connects to database through HTTP requests. Server dll in turn connect to the MS SQL Server 2000...
0
8394
marktang
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8306
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
8825
Oralloy
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8732
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...
1
8503
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
5632
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();...
0
4152
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
4304
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

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.