How to make sure a bounded form and subform in MS Access only submits to the database after a button click? - forms

A little information about the problem, I am fixing an old Access database that has a form bounded to a table "tblMain" and the subform is bounded to a table "tblSub" and the relationship between tblMain to tblSub is one to many, where tblSub has a field called belongs_to which is the id field of the record in tblMain that owns it.
So the main form holds one record and the subform holds many records that are tied to that one main record.
Is there any way for me to tell the two forms to wait to update to the database until after a button has been pressed?

There is no easy way to do what you are asking for. It basically comes down to use unbound forms and manually handling the inserts/updates.
I think you could possibly do this with an ADO recordset that is opened using adLockBatchOptimistic but I don't have a concrete answer on this.
I recommend you stick with the default behavior of MS Access or consider developing your solution in .Net where batch updating is the default behavior.

Related

Best way to manage the persistence of a form state, to and from a database

In a JSP/Servlet webapp, I have to implement a functionality that allows a user to save or restore a form state, that latter containing for instance some search criteria.
In other words, the user must be able to save or restore field values of a form, at any time. On the same page that contains that form, there's also another little form that allows him to name his form state before saving it. Then, later he'll be able to recall that state, via a combobox, and refill dynamically the form with the state he selected.
I know how to implement that by hand but I would prefer not to reinvent the wheel then I'd like to know if there are some frameworks managing that kind of functionality ? A mix between JSP taglib, filter class, jQuery or other JavaScript frameworks...
My research has not give anything yet.
Thank you in advance.

Multiple edit forms based on a template form

I'm working upon a small-scale enterprise database application. It works with such business objects as Vendors, Device types, Devices, Suppliers, Invoices, Departments, Employees etc., so I need to let users view and edit data from all these tables.
My first approach was to create a pair of forms for each type of business object:
a table to view and select an object
an editing form for this type of object
But now I find it hard to maintain all these forms, because e.g. if I want to change the look of all view forms, of course I have to edit each one of them.
So I want to replace all my view forms with a single one "template" form and to call it with some kind of parameters. The problem is, I don't know the right approach to perform it. Maybe there could be some example in some book or somewhere else?
I think the best way is by using Visual Form Inheritance .
Actually we use this kind of programming a lot, it keeps maintenance pretty simple. Stick your base functionality in the parent form, and specific behaviour in the child forms.

Dynamics CRM 2011: Adding non-entity form fields

I keep on finding myself wanting to add fields to CRM forms that don't actually represent physical fields on the entity. I want these fields to be sent in the Update message, for the benefit of my Plugins...
For example, imagine something like the out-of-the-box contact/address functionality. The main contact address is exposed as a set of fields on the Contact form. However, in actual fact there is some magic going on behind the scenes that causes an Address record to be created for the Contact containing the address details. I don't actually want to reproduce this, but it's a fair example...
Now, I know how to write a plugin that takes the address fields entered in the Create/Update message, and actually writes them into an Address object instead. That is simple enough. It seems the hard part is convincing CRM to display fields on the form for the user to enter the address data.
The only way I can see to do this is to create "fake" fields in the Contact-equivilent form, so that the form editor allows me to add the fields to the dialog. Then I have to filter these attributes out in a plugin, so the fake fields don't actually get written to the DB.
This would work, but involves filling the DB schema with fake columns that will (or should) never have any data in them. This makes future cusomisation of the system more confusing, as there are decoy fields called "DON'T USE - Address1" knocking around in all the GUIs. The problem gets worse when I need a fake Lookup field - this involves creating a fake relationship.
So: Is there a way to achieve the same thing without dumping fake garbage in the database schema?
Is there, perhaps, some way to create a form field for an arbitary attribute in Javascript on the form, such that the Attributes will be included in an Update message?
Sure, I realise I could IFrame or Silverlight something up to cater for this, but I'd rather use the genuine CRM form fields, and handle the data in the Update/Create message plugin hook.
Unfortunately, you have already mentioned the two options that I can think of: fake fields or custom IFrames.
I know it feels "dirty" but I actually haven't had much trouble doing the fake fields thing. Standardized naming conventions are your friend. I prefer fake fields over IFrames because users can still query and filter them in Advanced Find, reports, views, etc.
Just make sure they are readonly and make sure your plugins don't swallow exceptions - you want exceptions to bubble up and cancel the transaction instead of the possibility of the main record getting updated without the children.

K2 Blackpearl - populating SmartObject attributes

I'm very new to learning how to use K2 Blackpearl and am trying to understand how to effectively use SmartObjects.
Basically I have a list of questions I want to ask a user so currently I've created a smartObject with 2 attributes (Question, Answer). I have a list of all the questions I want to ask stored in a SQL server db.
Is it possible to auto-create either an InfoPath form or as ASP.NET page (At this stage I'm not too bothered which one I use - just want to see something working so please feel free to recommend which one is easiest) which will get the questions from the database and auto-create the 'fields' which the user will need to place an answer to the question... Then save this back to the smart object?
Thanks in advance for any help, much appreciated!
I see this question is very old and the suggestion of using InfoPath was probably good back then. For the record, as of today, InfoPath is no longer the recommended option.
Today, using SmartForms, I would create one SmartObject (smo) for your question/answer table (assuming there is a single answer per question, one table it enough). In your table, don´t forget colums to store whether the question is answered or not, by whom and when.
I would then suggest making 2 views: one list view to see all the questions and one item view mainly to answer a question.
When the user clicks on a question in the list view, you load it into the item view. The user can type/select and answer in the item view and click a button to 'send the answer' which effectively calls the update method of the smo.
This is s standard pattern, similar to listing updating users or pretty much any data in your DB. You just need to think about your data model to ensure you won´t stuck later on.
InfoPath is easiest to go, there's no real development, just clicking.
You can use a smartObject on the SQL database (using the Dynamic SQL Service Broker) to get the questions and load them in the InfoPath form. On the submit of the form, you can push the questions and answers to the SmartObject.
I would suggest making the 'answer' smartobject also based on a sql table, so you're data is nicely placed together.

Lotus Notes how to get a calculated value from another form using formula language

I have Lotus Notes application, deployed only as modifications (new forms, views, and adding a button to one of the "standard" views) in the main mail template (R7).
All these "new" forms and views are inherited in turn from my main application template.
Now, for one of these forms to function properly, it have to have a field, which is different from customer (not end user, but organization) to customer.
I do not want to break the inheritance from our template, so we can update the application easily by just sending a new template. So, I can't ask the client admin just to break the inheritance for this particular form, as it will stop all updates (or they have to be done manually).
So, let's say I have MainAppForm, which has a calculated field ClientCustomData. I'd like to have another form, which only has only one "default" field ClientCustomData. I can break the inheritance for this second form, as it has no really design elements which may change, and then the client can modify this default value to whatever they need w/o fearing that it'll be overwritten.
The question is - how from MainAppForm I can read the value from the other form?
Or - is there a way to store 2 data elements only in a mail template (I dunno, shared file, or something), so it becomes available to each user, and MainAppForm can get them, w/o a need to remove the inheritance dependency of MainAppForm from our template.
I can envision even a class library with just to functions to return this (I don't know why this approach smells to me).
Any best practices or advices?
I'm not sure if I have understood your querstion correctly, but it sounds like you want to have a small part of a larger form configurable per client. If this is the case, I think computed subforms could do the trick.
Consider the following scenario: Your application ships with the subform ClientCustomData that contains just sensible defaults for the client settings. The form MainAppForm includes this as a computed subform. It is then possible for the local admin to disable inheritance on the subform and changing the custom data without affecting inheritance on MainAppForm.
The obvious drawback is that you cannot update the ClientCustomData subform automatically once inheritance is disabled; Keep this subform as small as possible. If you find that you need more client-custom values, you can always add another subform in the same manner.
First a clarification: In Lotus Notes, you don't have forms reading from other forms. Forms are just UI objects. However, you do have back-end and front-end documents that get created with the help of Forms.
When you create a new document based on a form (for instance, a new email), you are creating a front-end document that hasn't been saved yet. That document can access other parts of itself or it can access any back-end document that has been saved.
If I'm following you correctly, you need some bit of data that is different per client/customer to be brought into documents based on MainAppForm. There are a few ways to do that. My suggestion is to use Database Profiles, which are special documents that can easily be accessed from anywhere in your database via Notes Formula language or LotusScript. Granted, you can't push data within those documents out via a template, but if you use a database profile to store your database settings your client admin can set options once and they won't get altered when the template changes.
Have a look at the #SetProfileField and #GetProfileField functions.
To answer my own question (still I do not know if I'm right in terms of Notes way of thinking, but looks promising):
I found the "Shared fields". So, I create 2 such a fields with a computed values (the ones I want to pass on), and make my MainAppForm use them. Upon installation, the admin will change the values and mark them to not refresh with the template.
I'd respect any pros and cons, provided from a Notes expert.
Thanks