Unbound vs Bound Forms

perhaps it's time to write a new article....
 
The workaround is usually to write data to a temp table and bind that to a continuous form.
The workaround I use is a disconnected ADO recordset - useful for being able to have an 'updateable' crosstab for example but still bound. updates etc being handled in vba. Only disadvantage with ado datasets is the inbuilt sort and filter functionality wont work, so you need to write your own shortcut menu if you want to users to have this functionality.
 
perhaps it's time to write a new article....
That's kind of what we are doing here in the form of a post instead. If someone creates a new article for real, I could link back to it at the top of the thread as well. As long as we get the end results everyone can agree on, it'll be good.
 
Not necessarily an unbound form, but more a disassociated table. (probably similar to @CJ_London just above)

I often like to use a temporary table(s) as a work area, and then move the data to the real table when I'm done.

That way, for instance, a user can enter an order, and if they decide to accept it, I move the data into the real order table with an append query/queries. If they change their mind, I can just clear the temporary table(s)
 
Here is a plug for unbound forms (for adding records only). The discussion afterwards was interesting too...
This is the same logic fallacy as the first article.
In the first article the solution for a horribly designed bound form is to make it unbound. Instead of simply designing a good bound form.
In this article the solution of separating data entry from data editing is to make the entry form unnbound, instead of simply making bound forms for data entry and data editing. It is dumb logic.

If you are an expert in writing VBA then you might find creating an unbound form is easier than figuring out how to build a proper bound form. For someone who can easily do both proper bound and proper unbound, I will tell you that you will do more work to do an unbound. That is not debatable. However, for some this may be easier if that is your skill set. The problem is when I see a novice who can barely write vba code, feel that the solution is to create an unbound form because they have read one of these uninformed articles. It is far easier to figure out how a bound form can do the exact same thing.

I am all for doing unbound forms if you have a strong reason. I just never can find anyone with a compelling reason. It is normally middle skilled developers who are over their head developing Rube Goldberg solutions. 99.9% of the time I see post when I ask what is the reason for going unbound, is because they do not know how to do the same thing bound in a far easier way. All this talk about the hidden complexity of the form events and when a record is saved... blah, blah is garbage. All anyone needs to know is the BeforeUpdate event. @Pat Hartman please write a thread on the BeforeUpdate, that is 99% of what you need.
 
For the record, I don't really have an opinion one way or the other. I almost always use bound forms for the very reason(s) you stated. Much more work to add the forms content to the applicable tables then to simply use inherit properties of the forms record source. It was interesting to me how others disagreed with him and how he handled it.
 
It was interesting to me how others disagreed with him and how he handled it.
My point is that the article is not really about bound vs unbound. It is about separating data entry from data editing. I am all for that, but the answer is not unbound forms. I see novice user trying to get a single form that does everything. It is a parent child form with the ability to add and delete parent and child records, navigate,, edit parent or child. For me that is 2-4 separate forms. I almost always separate navigation from adding/editing. Separate adding parent information from adding child information.
 
Fascinating discussion. It seems that the people who design their applications using bound forms believe that using them is best while the people who design using unbound forms think the opposite. I suppose we will choose whatever works best for us. That’s perfectly okay. For me this is a no brainer. I never use bound forms in my apps. Certainly, this causes me to incorporate much more VBA in my programs but it also gives me almost total control of my projects. An experienced coder, using any language, will not want to be limited by his IDE – and this is exactly what Microsoft Access will do if you let it. Take advantage of all the great things Access has to offer but code your applications as you would using any other language (Java, VB etc.). In my humble opinion, this is the way to go.
 
Project Cost = Developer Rate * Hours spent writing code and designing forms. If cost is not a factor (i.e. your client doesn't care how much you bill) by all means go for the method that expands hours billed.
 
Take advantage of all the great things Access to offer....
By never using bound forms, you have immediately ruled out one of the best things Access has to offer
 
Project Cost = Developer Rate * Hours spent writing code and designing forms. If cost is not a factor (i.e. your client doesn't care how much you bill) by all means go for the method that expands hours billed.
Great argument - casts a different light on the subject.
 
Building Access applications using Unbound forms is dumb! Not because unbound forms are dumb, but because Access is extremely poor at supporting unbound forms. If you have the skill set to write the code to build unbound forms why waste your time doing it in Access. For free you can do it in VS and do way more than Access can do. Dynamic controls, user controls, data grids, ado.net, etc. I do not get doing non-RAD things in a RAD development.
 
MajP - I think Access is excellent at supporting unbound forms. Also, its GUI is superb. I agree that VS is excellent as well, and I have used it many times, but I don't care much for the .NET framework.
PH - Why do you think I think Access is inferior? I've been using it for over 25 years. It's my favorite tool for desktop apps. Access doesn't demand that you use bound forms. It's just an option. I don't understand your "cutting hedges with a lawnmower" analogy. Why would anyone do that?
 
MajP - I think Access is excellent at supporting unbound forms.
IMO Access is pretty limited in support for unbound forms. Sure you can do it, just not a lot of features to do it. If you are going to do the work to bypass Access' strength of bound forms then use VS which is excellent for unbound forms. The biggest thing is the datagridview. So you can easily do unbound continuous form like things. You can fake this in access with a ton of work and a have inferior product. VS has a native treeview which to me is huge. Doing dynamic controls in Access is a non-starter. So with a lot of work you can get very average unbound forms in Access. Or for little work you can get the power of bound forms. As I said, I use unbound forms only to display data in ways that cannot do with a standard form, but never for data entry or editing.
Here is one I recent unbound concept I was suggesting.
You probably could do this bound as well, but this is a case were unbound requires less work. However, if you were doing that with a datagridview it would be clean and simple.
 
When I put together my biggest project, only about three out of over forty forms were unbound. In one case, it was a dispatcher or switchboard types of form. The other two cases were my "template" forms that I copied when creating new bound forms - one for a create/update/delete situation, one for a "viewer-only" form where the user couldn't make it generate anything if s/he tried. The trick was that the templates weren't bound - yet - because the development process started by copying one of the two forms, forms that had a lot of infrastructure already built in, such as having control buttons and headers and things in the Form_Load that looked up who you were from the network. But not bound until I specialized them. And that is the three unbound forms I made in my biggest project.
 
I'm sure your projects are wonderful but I'm also sure that you could achieve a similar result with less effort using bound forms if you understood the object mode.
It would be nice to see some side by side examples of a simple application done both ways. So if for instance TheSearcher showed us one of his predominantly unbound app, then one of us can do the same app using bound RAD techniques. Then we would have a con create example to discuss and point out the differences.

This then leads into a better understanding of the event model and object mode (whatever that is). Pat, did you mean object model?
 
Project Cost = Developer Rate * Hours spent writing code and designing forms. If cost is not a factor (i.e. your client doesn't care how much you bill) by all means go for the method that expands hours billed.
While this is obviously true, it might lead to a short-sighted view. It strongly emphasizes the initial development of a solution and often disregards the ongoing maintenance of a project. I've seen many projects where the quickest (=cheapest) possible approach was choosen for the initial development of a feature but by this the effort for maintaining and extending the functionality was drastically increased. - Finding the right balance can be a tough call. Planning for maintainability and extensibility of a feature involves a lot of guessing the future.
 
It would be nice to see some side by side examples of a simple application done both ways.
This example does not real showcase what you are asking, but was an attempt to answer a question. The applications that I have seen with heavy use of unbound forms are very brute force. They hardwire a lot of one-off code. I wanted to see why no one has made a wrapper to use unbound forms. I think I got a pretty close solution, then lost interest and never finished. Anyway I made a class called UnboundControl. An unbound control has a property to identify which table and which field it is "bound" to. I also built a collection of UnboundControls so that these can all work together.

The demo shows that using the classes I can Load a form by a simply passing the PK to the class or pass in a criteria for another field. Update the underlying table after edits while verifying the data types. Here is the entire code to do loading, data verification, and editing of 9 form fields. As you see this would be orders of magnitude shorter and easier than brute force.

Code:
Private UCS As New UnboundControls
Private Sub Form_Load()
  UCS.Initiliaze "tblDemoUnbound"
  UCS.Add Me.UCFirst, "first_Name"
  UCS.Add Me.UClast, "Last_Name"
  UCS.Add Me.UCemail, "Email"
  UCS.Add Me.UCPersonID, "PersonID"
  UCS.Add Me.UCdatefield, "DateField"
  UCS.Add Me.UClongfield, "longField"
  UCS.Add Me.UCdoublefield, "doubleField"
  UCS.Add Me.UCcurrencyfield, "currencyField"
 
End Sub
Private Sub cmdLoad_Click()
  UCS.LoadFromPK (Me.PersonID)
End Sub
Private Sub cmdUpdate_Click()
  Dim pk As Long
  pk = Me.PersonID
  UCS.UpdateFromPK (Me.PersonID)
  Me.Requery
  Me.Recordset.FindFirst "personID = " & pk
End Sub
Private Sub cmdEmail_Click()
  If Not Trim(Me.cmboEmail & " ") = "" Then
   UCS.LoadFromCriteria ("email = '" & Me.cmboEmail & "'")
  End If
End Sub

If I personally was going to do unbound forms, I think I would finish these classes and leverage them. I think I determined that no matter how much I added to these classes there would always be exceptions that needed to get hard coded.
 

Attachments

Users who are viewing this thread

Back
Top Bottom