Results 1 to 10 of 10
  1. #1
    edmscan is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Feb 2014
    Posts
    168

    Unbound Controls on Continuous Forms Question ?

    Ok .. here you go. I like continuous forms. They look pretty mostly is why I like them.

    But .. issues as using unbound controls are not that much fun and I am pretty limited.

    Here is my issue .. I have a form as below and I use Datepart("h",[TransTime]) to get the hour which I then use for the actual number of transmissions in that hour. (This is for a radio system). Pretty straight forward stuff .. but I wanted to display the actual time on the form.

    So .. hour 14 would be "2:00:00 PM - 2:59:59 PM". I did get it to work as you can see .. but is there an easier way ?



    I tried a recordset clone .. and making the value of my unbound text box based on the bound hour number field. But .. I always got the same values .. in this case, the last one "11:00:00 PM - 11:59:59 PM" for all of my 24 records on the form.

    What I did .. is make a lookup table with the hour and timetext in it. So .. 14 as a number field and the text as above. I made a query to link up the transmission counts / hours with this time value from this lookup table. I understand that on a continuous form .. your query control source must contain the data for your fields ? unless of course you want to overly complicate things.

    I just want to get away from the lookup table .. it works. But .. is it so hard to use an unbound control on a continuous form ?

    Below is the end result .. it works, I just want to learn if there is a better way.

    Click image for larger version. 

Name:	Untitled.png 
Views:	19 
Size:	33.3 KB 
ID:	17232

  2. #2
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    You should be able to create a formula using your hour field, TimeSerial() and probably the Format() function.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    The only way to use an Unbound Control, on a Continuous View Form (also applies to Datasheet View Forms) and have it be record-appropriate, is to use its Control Source Property. In this case, since the 'hour' Field is an actual Number, something like

    Code:
    =DLookup("TimeTextField","YourLookupTableName", "[HourNumberField]=" & Me.HourNumberControl)
    Replacing all of the names, above, with your actual names.

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  4. #4
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Quote Originally Posted by Missinglinq View Post
    The only way to use an Unbound Control, on a Continuous View Form (also applies to Datasheet View Forms) and have it be record-appropriate, is to use its Control Source Property. In this case, since the 'hour' Field is an actual Number, something like

    Code:
    =DLookup("TimeTextField","YourLookupTableName", "[HourNumberField]=" & Me.HourNumberControl)
    Replacing all of the names, above, with your actual names.

    Linq ;0)>
    The request was to "get away from the lookup table".
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    edmscan is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Feb 2014
    Posts
    168
    It is working .. so I am good. However maybe a Continuous form is not the answer in all cases. They just seems restricted compared to a normal form. I very much prefer unbound controls .. and almost never use bound controls.

    I do not need to edit any of the data .. just need to view it. So .. for now all is good. I tested it .. and the performance is just fine. The use of that table does not appear to affect performance as really there is only like 24 records.

  6. #6
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    Quote Originally Posted by edmscan View Post

    ...I very much prefer unbound controls .. and almost never use bound controls...
    Then you have no business using MS Access! The whole point of Access is the rapid development of relational databases.

    Several developers I know, very experienced in Visual Basic database development and Access development, estimate that development, using Unbound Forms, by highly experienced developers, takes two to three times as long, using Unbound Forms, as it does when using Access and Bound Forms. That's because with Bound Forms, Access takes care of the 'heavy lifting,' but with Unbound Forms, the developer has to write code to take care of just about everything.

    If you insist on using Unbound Forms, you'd be far better off using a straight VB or C++ front end with a SQL Server or Oracle back end.

    • You can create an EXE file which gives total protection to your code/design
    • You can distribute the db to PCs without a copy of Access being on board
    • Your data security is far, far better than anything you can do in Access


    Simply put, if you want to do everything using Unbound Forms, you're using the wrong development environment.

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  7. #7
    edmscan is offline Competent Performer
    Windows 8 Access 2010 32bit
    Join Date
    Feb 2014
    Posts
    168
    Quote Originally Posted by Missinglinq View Post
    Then you have no business using MS Access! The whole point of Access is the rapid development of relational databases.

    Simply put, if you want to do everything using Unbound Forms, you're using the wrong development environment.

    Linq ;0)>

    I don't disagree .. however, I do my development for myself for my own purposes. Rapid development is not an issue .. but for some it may be.

    I have also developed in VB and C++ in the past .. and each have their good and bad points. This is the same for Access.

  8. #8
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Quote Originally Posted by edmscan View Post
    It is working .. so I am good. However maybe a Continuous form is not the answer in all cases. They just seems restricted compared to a normal form. I very much prefer unbound controls .. and almost never use bound controls.

    I do not need to edit any of the data .. just need to view it. So .. for now all is good. I tested it .. and the performance is just fine. The use of that table does not appear to affect performance as really there is only like 24 records.
    To skip the table per your original request, this may give you an idea:

    ?format(timeserial(4,0,0),"h:nn:ss ampm") & " - " & format(timeserial(4,59,59),"h:nn:ss ampm")
    4:00:00 AM - 4:59:59 AM
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  9. #9
    edmscan is offline Competent Performer
    Windows 8 Access 2010 32bit
    Join Date
    Feb 2014
    Posts
    168
    Thanks Paul .. I will give it a try and see what I can do. It seems simple that it should be possible.

    I did .. =format(timeserial([HourNumber],0,0),"h:nn:ss ampm") & " - " & format(timeserial([HourNumber],59,59),"h:nn:ss ampm")

    EDIT .. Paul that worked perfectly. Thanks.

  10. #10
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Happy to help!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 10
    Last Post: 12-24-2013, 12:53 PM
  2. Replies: 2
    Last Post: 10-19-2013, 09:32 PM
  3. Populating a Continuous Form with Unbound Fields
    By gazzieh in forum Programming
    Replies: 6
    Last Post: 02-28-2013, 11:11 AM
  4. Writing multiple unbound controls to a table
    By dccjr in forum Programming
    Replies: 4
    Last Post: 11-28-2012, 08:18 PM
  5. Replies: 1
    Last Post: 07-13-2012, 09:13 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums