I have several databases where I have one form to add a new record and one form
to edit an existing record. I use unbound forms and class modules most of the
time.
What I would like to do is have one form that handles both adding a new record
to the database and editing the same type of record. The form would be altered
in the load event to change whatever needs to be changed to show the form
in an "Add" mode vs. and "Edit" mode (I guess???).
Does anyone have any ideas/experience on this? I'm sure in an truly OOP
environment this is childs play/standard operating procedure. Please let me
know what you think.
Johnny 11 1682
"Johnny M" <jm*******@gmai l.com> wrote in message
news:55******** *************** ***@posting.goo gle.com... I have several databases where I have one form to add a new record and one form to edit an existing record. I use unbound forms and class modules most of the time.
What I would like to do is have one form that handles both adding a new record to the database and editing the same type of record. The form would be altered in the load event to change whatever needs to be changed to show the form in an "Add" mode vs. and "Edit" mode (I guess???).
Does anyone have any ideas/experience on this? I'm sure in an truly OOP environment this is childs play/standard operating procedure. Please let me know what you think.
When you open the form, use the DataMode argument to open in Add or Edit
mode, depending on whether you want to add a new record or edit an existing
one. If you're editing an existing record, pass the PK value of the record
in the OpenArgs argument and have your editing form filter the underlying
data source to find this record.
Johnny M wrote: I have several databases where I have one form to add a new record and one form to edit an existing record. I use unbound forms and class modules most of the time.
Why do you use *unbound* forms when they are supposed to operate upon
data? Bound forms do these jobs quite well, and they're built in.
This is not (merely) a criticising statement, there are times I don't
like the way Access handles various events so I'd like to see your chain
of thought.
> When you open the form, use the DataMode argument to open in Add or Edit mode, depending on whether you want to add a new record or edit an existing one. If you're editing an existing record, pass the PK value of the record in the OpenArgs argument and have your editing form filter the underlying data source to find this record.
The forms are unbound, so the ADD/EDIT mode is irrelevant, right? Also, I
avoid openargs. I use classes stored in global variables to pass info between
forms.
I'm really looking for a way to mimic inheritance. So, for instance, if I have
a class Document, three derived classes, IDR, NPA, and Claim. I would like
a single Document form, that is changed appropriately based on what Document
I'm actually working with. In VBA, I just have the three class modules IDR,
NPA, and Claim (no abstract class Document, of course.) I just want to know
if anyone has any technique to do this with a form so I don't have to maintain
a bunch of forms that look nearly identical.
Most of my forms are set up like so:
A listBox at the bottom of the form contains a list of all records. Next to
the listBox are two buttons, Edit and New. The New button adds a new
record; the Edit button Finds the needed record and makes it the current
record.
The form is originally opened with all controls except these disabled; only
by selecting Edit or New do the textBoxes and comboBoxes for entereing data
become enabled. Save and Cancel buttons return control to the listBox and
disable the other controls after saving/cancelling.
When a form is loaded, or at some point prior, data from the BE table is
copied to an identical FE table, which is used as the recordsource for the
FE bound form. On Save, the new/edited record is copied to the BE table. I
gain what is to me the considerable benefit of using bound forms, without
the drawbacks of using linked tables.
Darryl Kerkeslager
"Johnny M" <jm*******@gmai l.com> wrote: I have several databases where I have one form to add a new record and one
form to edit an existing record. I use unbound forms and class modules most of
the time.
What I would like to do is have one form that handles both adding a new
record to the database and editing the same type of record. The form would be
altered in the load event to change whatever needs to be changed to show the form in an "Add" mode vs. and "Edit" mode (I guess???).
Johnny M wrote: I have several databases where I have one form to add a new record and one form to edit an existing record. I use unbound forms and class modules most of the time.
What I would like to do is have one form that handles both adding a new record to the database and editing the same type of record. The form would be altered in the load event to change whatever needs to be changed to show the form in an "Add" mode vs. and "Edit" mode (I guess???).
Does anyone have any ideas/experience on this? I'm sure in an truly OOP environment this is childs play/standard operating procedure. Please let me know what you think.
How would you like to handle tables with (vastly) different amounts of
fields? Controls can be created (and deleted) in design view only.
I get the impression I am interested in your project. Do you care for an
email discussion?
"Johnny M" <jm*******@gmai l.com> wrote in message
news:55******** *************** ***@posting.goo gle.com... When you open the form, use the DataMode argument to open in Add or Edit mode, depending on whether you want to add a new record or edit an existing one. If you're editing an existing record, pass the PK value of the record in the OpenArgs argument and have your editing form filter the underlying data source to find this record.
The forms are unbound, so the ADD/EDIT mode is irrelevant, right? Also, I avoid openargs. I use classes stored in global variables to pass info between forms.
I'm really looking for a way to mimic inheritance. So, for instance, if I have a class Document, three derived classes, IDR, NPA, and Claim. I would like a single Document form, that is changed appropriately based on what Document I'm actually working with. In VBA, I just have the three class modules IDR, NPA, and Claim (no abstract class Document, of course.) I just want to know if anyone has any technique to do this with a form so I don't have to maintain a bunch of forms that look nearly identical.
I would suggest changing to use bound forms - otherwise you're creating a
lot of extra work for yourself with input validation. Plus you lose the
advantage of many of the form's data-driven events. If you don't want to
maintain a connection to the underlying data source you can create your own
recordset using ADO, disconnect it from the underlying source and then bind
it to the form. When the user presses OK, you just walk through the
recordset and update or add the record in code as appropriate. I know this
technique works for SQL Server data - I think it also works for Jet in
Access XP but you'll need to check that one.
"Johnny M" <jm*******@gmai l.com> wrote in message
news:55******** *************** ***@posting.goo gle.com... When you open the form, use the DataMode argument to open in Add or Edit mode, depending on whether you want to add a new record or edit an
existing one. If you're editing an existing record, pass the PK value of the
record in the OpenArgs argument and have your editing form filter the
underlying data source to find this record. The forms are unbound, so the ADD/EDIT mode is irrelevant, right? Also, I avoid openargs. I use classes stored in global variables to pass info
between forms.
I'm really looking for a way to mimic inheritance. So, for instance, if I
have a class Document, three derived classes, IDR, NPA, and Claim. I would
like a single Document form, that is changed appropriately based on what
Document I'm actually working with. In VBA, I just have the three class modules
IDR, NPA, and Claim (no abstract class Document, of course.) I just want to
know if anyone has any technique to do this with a form so I don't have to
maintain a bunch of forms that look nearly identical.
You mimic inheritance in VBA using containment and delegation. Two concepts
that you should be familiar with if you're interested in using OOP with
Access.
The only practical way of using a single form for multiple operations is to
create one that contains all the controls neccesary for each. Make all
common controls visible and show any additional ones when needed.
Instead of passing a document object to a form your document object would
contain an instance of the form. The appearance of the form and the showing
of additional controls is handled when the document object is instantiated.
Obviously your Document object would have complete knowledge of the form's
controls and would have to handle some of the events.
Personally I'd take another look at using multiple bound forms. jm*******@gmail .com (Johnny M) wrote in
news:55******** *************** ***@posting.goo gle.com: I have several databases where I have one form to add a new record and one form to edit an existing record. I use unbound forms and class modules most of the time.
What I would like to do is have one form that handles both adding a new record to the database and editing the same type of record. The form would be altered in the load event to change whatever needs to be changed to show the form in an "Add" mode vs. and "Edit" mode (I guess???).
Does anyone have any ideas/experience on this? I'm sure in an truly OOP environment this is childs play/standard operating procedure. Please let me know what you think.
Johnny
With a bound form, it's as easy as opening the form with
different arguments,
DoCmd.OpenForm stDocName,,,,ac FormAdd
DoCmd.OpenForm stDocName,,,,ac FormEdit
--
Bob Quintal
PA is y I've altered my email address.
> I would suggest changing to use bound forms - otherwise you're creating a lot of extra work for yourself with input validation.
Do you use table level validation rules? Where does you validation occur when
using bound forms? This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Stephen Poley |
last post by:
I have quite often (as have probably many of you) come across HTML forms
with irritating bits of Javascript attached. The last straw on this
particular camel's back was a large form I was asked to complete in
connection with attendance at a seminar. After spending more than 15
minutes on it, I clicked on the submit button - and nothing happened.
Looking round the pages on Javascript form validation that Google
produced for me (well,...
|
by: KS |
last post by:
I got 2 inputs in a form where I want check if start > end. Seems like it
just compare the first number when I got this code in javascript
"if(document.all.start > document.all.end)"
How do i solve this so it compare 2 > 10 as, is two bigger than ten, and
not, is two bigger than one.
Thanx in advance
|
by: Sergio Otoya |
last post by:
Hi all,
I need to add an input hidden field to an existing form (post).
I have tried a couple things like adding the '<INPUT type=hidden
name=idSelectedURL value=http://server/documents>' to the innerHTML of
the form but it fails.
ie
|
by: allyn44 |
last post by:
HI--what I am trying to do is 2 things:
1. Open a form in either data entry mode or edit mode depending on
what task the user is performing
2. Cancel events tied to fields on the form if I am in edit mode.
The reason I want to do this is becasue when entering a new record the
form is entered in data entry mode and I have lots of stuff happening
upon entering and leaving fields. In edit mode I do not want the
events to fire.
|
by: TD |
last post by:
This is the code under a command button -
Dim ctl As Control
For Each ctl In Me.Controls
If ctl.BackColor <> RGB(255, 255, 255) Then
ctl.BackColor = RGB(255, 255, 255)
End If
Next ctl
| |
by: Timothy.Rybak |
last post by:
Hello all,
This is my first attempt at an application, so kid gloves are
appreciated.
I need to make a very simple form that only has a few elements. One is
TraceCode - a text field that is populated when a user scans a label.
The other is ScanDate - a date/time field that should equal the
date/time of the scan (e.g. 7/31/2006 5:00:00 AM).
|
by: superjacent |
last post by:
Hope someone can help.
I have a saved parent form containing an unbound sub-form. I set the
SourceObject (form) after the Parent Form opens/loads.
The sub-form (datasheet view) basically displays the results of a
cross-tab query The cross-tab query is created dynamically (in code)
as the column headings are subject to change.
I therefore have to create a new form (in code) and add the necessary
|
by: radio1 |
last post by:
Configuration: Access 2002 and SQL Server 2000 using a .ADP Project.
I would VERY MUCH appreciate anyone's input into this problem I'm having.
I have a form in Access that does not permit the user to add/change/delete any data, apparently as a result of adding a GROUP BY clause to a View used indirectly as the form's Record Source.
I really don't believe that this restriction needs to be there, and I'm hoping that someone can suggest...
|
by: Jon Slaughter |
last post by:
Sorry for all the cross posting but I'm interesting in getting a serious
discussion about how usenet has become lately.
Many people are moving away from usenet because of all the spam and cooks
that have been showing up. The rate of spammer seem to be growing
exponentially(ok, not really but it feels like it).
I think maybe its time to do something about it. What I'd like to see happen
is an "upgrade" to usenet. I do not like th forum...
|
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...
|
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...
| |
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,...
|
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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: 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...
| |