Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old November 28th, 2004, 04:13 PM
Friend of Wrox
 
Join Date: Mar 2004
Location: Yorba Linda, California, USA.
Posts: 217
Thanks: 0
Thanked 1 Time in 1 Post
Default acformreadonly causing subforms to not show

I have been struggling to fix a problem it appears I caused by opening a form in acformreadonly mode.
I have a form with several subforms attached. Some are in datasheet view and some are in single form view. The form launched fine and the subforms ALL worked fine until I tried adding the acformreadonly argument to open the main form.
Once added, the subforms in SINGLE-FORM VIEW do not display in some records only (nothing displays- the subform is completely blank). The records that display consistently display, and those that do not display consistently do not display. Subforms that have at least one record in their recordset display ALL the time. The subforms that have no data either always display or never display, but they are consistent. When I remove the acformreadonly argument the form displays ALL the subform records fine. (I am later unhiding the form- achidden is just there to stop VBAAccess from complaining it cannot find the target form) (This problem is not affecting subforms in datasheet view.)

(some of the subforms to not work when opened with this:)
DoCmd.OpenForm "frmPracticeData" , , , , acFormReadOnly , achidden

(All the subforms work when opened with this-but it does not get me a read only form)
DoCmd.OpenForm "frmPracticeData" , , , , acFormReadOnly , acHidden

For data protection purposes I want to launch the form as read only as the default, but allow the user to specify (via a checkbox)at the time the form is opened that they want to edit data. There are no error messages or other signs of trouble. I am working with A2k.

Any advise, work arounds, ideas on other things to check or try are appreciated. I'm just a beginner- Am I doing something obviously wrong?



Reply With Quote
  #2 (permalink)  
Old December 1st, 2004, 04:19 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: Norwich, Norfolk, United Kingdom.
Posts: 129
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Instead of making the form read-only, have you tried locking/unlocking the editable controls?



Clive Astley
Reply With Quote
  #3 (permalink)  
Old December 1st, 2004, 11:36 PM
Friend of Wrox
 
Join Date: Mar 2004
Location: Yorba Linda, California, USA.
Posts: 217
Thanks: 0
Thanked 1 Time in 1 Post
Default

Yes, I have locked the controls and provided a button for the user to unlock, then lock again. I'm trusting them to re-lock and take extra care with the mouse....... I was hoping to protect the whole form in a more "craftsman-like" and transparent way via using the acformreadonly.

Thanks!
Loralee

Reply With Quote
  #4 (permalink)  
Old December 2nd, 2004, 03:36 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: Norwich, Norfolk, United Kingdom.
Posts: 129
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You could provide a "Save" button to save the edits. The save button could re-lock the controls. Similarly, disable any other movements (eg to another record) until the edits have been saved or abandoned.



Clive Astley
Reply With Quote
  #5 (permalink)  
Old December 2nd, 2004, 11:57 PM
Friend of Wrox
 
Join Date: Mar 2004
Location: Yorba Linda, California, USA.
Posts: 217
Thanks: 0
Thanked 1 Time in 1 Post
Default

I do have a lock("edit") and unlock ("save") button but have not disabled movement through the recordset. Would that just to disable the navigation buttons?
Also, I had tried using the mouseover for the main form to relock the subform but got alot of screen flicker, so I abandoned that really quick. Any ideas of another place I could possibly put the re-locking code?
Thank You for your help.
Loralee

Reply With Quote
  #6 (permalink)  
Old December 3rd, 2004, 03:41 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: Norwich, Norfolk, United Kingdom.
Posts: 129
Thanks: 0
Thanked 0 Times in 0 Posts
Default

There's a good discussion on form locking in Wrox Beginning VB6 Database by John Connell.


Clive Astley
Reply With Quote
  #7 (permalink)  
Old December 3rd, 2004, 11:59 PM
Friend of Wrox
 
Join Date: Mar 2004
Location: Yorba Linda, California, USA.
Posts: 217
Thanks: 0
Thanked 1 Time in 1 Post
Default

Thanks, I'll pick up a copy this weekend. Is VB6 closely related enough to VBA that it would apply?

One of the programmers at work suggested trying a snapshot recordset (which worked in limited testing, but haven't had a chance to drop that into the db in place of the offending code.) Also thought it might be worth converting it into Access 2003 and see what happens.....
THANKS!!!

Reply With Quote
  #8 (permalink)  
Old December 4th, 2004, 02:57 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Norwich, Norfolk, United Kingdom.
Posts: 129
Thanks: 0
Thanked 0 Times in 0 Posts
Default

On the face of it, a snapshot recordset sounds great. But I don't think you can bind a form to a recordset?

Re VB6 and VBA. I use both and find books on each invaluable to my knowledge of the other.

Best wishes,

Clive Astley
Reply With Quote
  #9 (permalink)  
Old December 5th, 2004, 12:34 AM
Friend of Wrox
 
Join Date: Mar 2004
Location: Yorba Linda, California, USA.
Posts: 217
Thanks: 0
Thanked 1 Time in 1 Post
Default

I briefly tried writing to the recordsettype property (form.recordsettype = 2)and it seemed to load and display the subforms in single form view without problem. Of course, that was only with about 15 minutes fooling around with it. At least all the records I tried which didn't display via acformreadonly were fine with recordsettype being set to snapshot.

Thanks!!!

Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Subforms 150563a Access 1 June 29th, 2007 05:57 AM
Float causing background-color not to show wheelie CSS Cascading Style Sheets 3 January 24th, 2006 07:29 AM
subforms ajmil11 Access 2 January 19th, 2006 11:16 PM
Subforms V Access VBA 1 April 21st, 2004 12:48 PM



All times are GMT -4. The time now is 06:31 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.