[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Bug Activating .orientation property on VB6 report

Posted on 2004-11-01
5
Medium Priority
?
474 Views
Last Modified: 2008-03-06
This is code taken from an App in which I am printing VB 6.0 datsheet reports from a form.

With rptCoverSheet2
  Set .DataSource = rsCoverSheet
  .DataMember = rsCoverSheet.DataMember
  DoEvents
    If PrintEm = True Then
'        .Orientation = PickedOrientation
        .PrintReport
    Else
        .Show vbModal
    End If
 
End With

Notice that the line
.Orientation = PickedOrientation
 is commented.

The variable PickedOrientation is set in another module and I verfied that it is set correctly.  Here's my dilemma.  I inserted this code and tested this module successfully.  The line was working perfectly to set the orientation of the printed output.  Thinking I had this issue reolved I exited VB completely.  Later in the day I was going to create an EXE to deliver to my client.  Amazingly the statement which had compiled before was giving me a compile error even though I had made absolutely no changes.  After much time and the efforts of my parter, he discovered the key.  If while in VB development environment, the datasheet report 'rptCoverSheet2' was opened, the .orientation line would compile and function correctly.  No changes to the report were required.  The report could be opened and then immediately closed again.  An .EXE created at this point functioned correctly.  Once I exited VB and re-entered the line would not compile until I opened and the closed the report.

Can anyone explain this?  It really sounds like something to report to MicroSoft.



'
0
Comment
Question by:mlcktmguy
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 12469801
I would suggest that you reinstall VB SP (you need at least SP4 to use this property).
0
 
LVL 1

Author Comment

by:mlcktmguy
ID: 12469808
I have SP6 installed
0
 
LVL 70

Accepted Solution

by:
Éric Moreau earned 2000 total points
ID: 12469939
have you tried to reinstall it?
0
 
LVL 1

Author Comment

by:mlcktmguy
ID: 12469981
Sorry, I wasn't clear.  Yes I did reinstall it.  Still got the same situation.
0
 
LVL 1

Author Comment

by:mlcktmguy
ID: 12470081
emoreau,
Thanks for your interest in my problem.  I did some more research and found the following.
Apparently I have a know problem because it is mentioned on the knowledgebase.  I quote it below:

"When you use this new Orientation property in Visual Studio 6.0 Service Pack 4, you may encounter the error below:

Compiler Error

Method or Data member not found.

To fix this error, delete the values for DataMember and DataSource properties of the Data Report and reassign these two properties with the original values."

This comment seems directly realted to my problem but I have a further dilemma because of the way I am currently generating the file to print the report.

What do I do with DataMember and DataSource to solve the problem?  When I defined my report all of the fields are unbound and I left DataMember and DataSource blank because I create the recordsets from proprietary file formats directly prior to executing the code which outputs the reports.  I have no Data Enviroment in this project.  An example of my code to create my DataMember and DataSource is below.  I take the fields from the Form and create a recordset then a record.  Finally I bind those fields to the DataReport fields.

Dim rsCoverSheet As New ADODB.Recordset

With rsCoverSheet
  .Fields.Append "lbl01", adVarChar, 30
  .Fields.Append "lbl02", adVarChar, 30
  .Fields.Append "lbl03", adVarChar, 30
  .Fields.Append "lbl04", adVarChar, 30
  .Fields.Append "lbl05", adVarChar, 30
  .Fields.Append "lbl06", adVarChar, 30
  .Fields.Append "lbl07", adVarChar, 30
  .Fields.Append "lbl08", adVarChar, 30
  .Fields.Append "lbl09", adVarChar, 30
  .Fields.Append "lbl10", adVarChar, 30
  .Fields.Append "lbl11", adVarChar, 30

  .Fields.Append "RptEvalDate", adVarChar, 20
  .Fields.Append "txt00", adVarChar, 240
  .Fields.Append "txt01", adVarChar, 240
  .Fields.Append "txt02", adVarChar, 240
  .Fields.Append "txt03", adVarChar, 240
  .Fields.Append "txt04", adVarChar, 240
  .Fields.Append "txt05", adVarChar, 240
  .Fields.Append "txt06", adVarChar, 240
  .Fields.Append "txt07", adVarChar, 240
  .Fields.Append "txt08", adVarChar, 240
  .Fields.Append "txt09", adVarChar, 240
  .Fields.Append "txt10", adVarChar, 240
  .Fields.Append "txt11", adVarChar, 240
  .CursorType = adOpenKeyset
  .LockType = adLockOptimistic
  .Open

    Dim f As New frmCoverSheet
    .AddNew
    ![lbl01] = f!FacilCap.Text
    ![lbl02] = f!ParticCap.Text
    ![lbl03] = f!Partic1Cap.Text
    ![lbl04] = f!Partic2Cap.Text
    ![lbl05] = f!SMECap.Text
    ![lbl06] = f!SME01Cap.Text
    ![lbl07] = f!SME02Cap.Text
    ![lbl08] = f!SME03Cap.Text
    ![lbl09] = f!SME04Cap.Text
    ![lbl10] = f!SME05Cap.Text
    ![lbl11] = f!SME06Cap.Text

    ![RptEvalDate] = f!dtPick.Value
    ![txt00] = f!CovText(0).Text
    ![txt00] = f!CovText(0).Text
    ![txt01] = f!CovText(1).Text
    ![txt02] = f!CovText(2).Text
    ![txt03] = f!CovText(3).Text
    ![txt04] = f!CovText(4).Text
    ![txt05] = f!CovText(5).Text
    ![txt06] = f!CovText(6).Text
    ![txt07] = f!CovText(7).Text
    ![txt08] = f!CovText(8).Text
    ![txt09] = f!CovText(9).Text
    ![txt10] = f!CovText(10).Text
    ![txt11] = f!CovText(11).Text
    .Update

    Set f = Nothing
   
End With
'
Printer.Orientation = PickedOrientation
With rptCoverSheet2
  Set .DataSource = rsCoverSheet
  .DataMember = rsCoverSheet.DataMember
  DoEvents
    If PrintEm = True Then
'        .Orientation = PickedOrientation
        .PrintReport
    Else
        .Show vbModal
    End If
 
End With
'
rsCoverSheet.Close
'
Set rsCoverSheet = Nothing

Any help would be greatly appreciated.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question