• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 486
  • Last Modified:

Bug Activating .orientation property on VB6 report

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
mlcktmguy
Asked:
mlcktmguy
  • 3
  • 2
1 Solution
 
Éric MoreauSenior .Net ConsultantCommented:
I would suggest that you reinstall VB SP (you need at least SP4 to use this property).
0
 
mlcktmguyAuthor Commented:
I have SP6 installed
0
 
Éric MoreauSenior .Net ConsultantCommented:
have you tried to reinstall it?
0
 
mlcktmguyAuthor Commented:
Sorry, I wasn't clear.  Yes I did reinstall it.  Still got the same situation.
0
 
mlcktmguyAuthor Commented:
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

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now