Wrox Programmer Forums
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 29th, 2004, 08:24 PM
Authorized User
 
Join Date: Jun 2003
Posts: 34
Thanks: 0
Thanked 0 Times in 0 Posts
Default Closing automated report

Hello all.:D

OK here it is. I have a form with five combo boxes that are populated with a table's field names and a single command button. After selecting one or more fields pressing the command button opens a report that has been formatted using the selected fields. The problem is that after I close the report it pops up in design mode and when I close that it then asks if I would like to save the changes. Ideally I would like the report to just close and not save the changes and return to the original form.

Here is the code I'm using in the command button:

Dim rs As DAO.Recordset
Dim i As Integer
Dim prevColwidth As Long
Dim lngMaxVal As Long
Dim fldval As String
Dim mywidthval As Integer

lngLeft = 0
lngTop = 0

DoCmd.OpenReport "AccessColumnBuilder", acViewDesign, , , acHidden
Set rpt = Reports![AccessColumnBuilder]
reportQuery = Me.Label44.Caption
Set rs = CodeDb().OpenRecordset(reportQuery)
rpt.RecordSource = reportQuery
prevColwidth = 0
lblCol = 0

For i = 0 To rs.Fields.Count - 1
        Set txtNew = CreateReportControl(rpt.Name, acTextBox, acDetail, , , lngLeft + prevColwidth, lngTop)
      txtNew.SizeToFit
      Debug.Print txtNew.Width
      mywidthval = txtNew.Width
      txtNew.ControlSource = rs(i).Name
      txtNew.TextAlign = 1
      prevColwidth = prevColwidth + txtNew.Width
      Set labNew = CreateReportControl(rpt.Name, acLabel, acPageHeader, , rs.Fields(i).Name, lblCol, , , lngTop)
      labNew.Width = mywidthval
      lblCol = lblCol + 5 + labNew.Width
Next

DoCmd.OpenReport "ReportBuilder", acViewPreview

End Sub




Thanks,
Jesse
__________________
Thanks,
Jesse
 
Old January 29th, 2004, 09:39 PM
sal sal is offline
Friend of Wrox
 
Join Date: Oct 2003
Posts: 702
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I do not like to read code.
Why are you trying to open the report in design mode? What are you trying to do?
Anyway. If you open it in design mode and change something you have to decide whether to save the change or not at some point in time.



Sal





Similar Threads
Thread Thread Starter Forum Replies Last Post
Automated E-mail Envirochemist Access 3 April 25th, 2008 11:23 AM
Automated email ashik112 Classic ASP Professional 3 March 14th, 2007 11:11 PM
Automated tasks in ASP Steve777 Classic ASP Professional 3 June 3rd, 2005 01:52 PM
Automated debugging JAVA Java GUI 0 April 14th, 2004 05:11 AM
Closing Automated Report jesseleon Access VBA 2 February 3rd, 2004 08:27 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.