Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Error: "Object not defined" upon showing a data report

Posted on 2004-04-05
19
Medium Priority
?
680 Views
Last Modified: 2013-12-26
I used a data report and used Jet.OLEDB.4.0 (something like that) and mapped it to C:\(folder name)\(database name). The connection was successful and i used Visual Studio's  package and deployment wizard to make the installer. Windows did not want me to install the software (due to security reasons in the network) so what i did was just temporarily copied the files in a directory along with all the DLLs and .exe file. Please note that everything works ok but upon clicking print (upon clicking print, i want the datareports to pop up) i keep getting an error, "Object not defined"

I made sure that the path to the database was correct. I did the same to my pc (that has VB installed in it) to test it just in case it did not want me to install using package and deployment wizard and it worked fine. I don't know if this is because i already have VB in my pc already which could be a possibility.

So when i just copy all the DLLs, OCXs, and exe files to a specific directory without actually using the wizard, how to i get the data report to work? Another question, how can i manually code the database path in the dataenvironment if i want to access a database in another pc on a network?

Please help me out and thanks in advance. I would really appreciate it!

jrobles
0
Comment
Question by:jrobles1232000
[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
  • 8
  • 6
  • 5
19 Comments
 
LVL 9

Expert Comment

by:p_sie
ID: 10758999
I guess you are using Windows XP and that's why your project is working, cause XP has the VB-dll installed by default. It has not installed the components for the data-report, so they need to be installed...
Copying exe, dll and ocx's does not make them installed! That's why there are installation programs.

0
 
LVL 9

Assisted Solution

by:p_sie
p_sie earned 500 total points
ID: 10759086
For setting the database path:

try using DataEnvironment1.Connection1.ConnectionString

first see what it gives you using

msgbox DataEnvironment1.Connection1.ConnectionString

then try setting it... Make sure you close the connection first before changing the location...
0
 

Author Comment

by:jrobles1232000
ID: 10759106
the OS i tried to install the system in is Windows 2000 professional, it keeps saying something like some of the files are not updated, to update you have to restart the pc. Whenever i do restart the pc, and run the wizard it still prompts the same error and prompts to restart the pc again. Do I have to log in as administrator for me to install the software using the package and deployment wizard?
0
Industry Leaders: 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!

 
LVL 9

Expert Comment

by:p_sie
ID: 10759924
I think that the answer is yes, cause the P&D wizard will try to install system files (check the .lst file). Users with no administrator rights can not do such things.

0
 

Author Comment

by:jrobles1232000
ID: 10762859
This is my code for the connection string:

If DataEnvironment1.Connection1.State = adStateOpen Then
    DataEnvironment1.Connection1.Close
End If

DataEnvironment1.Connection1.ConnectionString = "Provider=MSDataShape.1;Persist Security Info=False;Data Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\(folder)\(database name);"

it works fine the first time, but upon showing it again, it keeps saying "Failed getting Rowset(s) from current data source"

I'm using an SQL statement "SELECT * FROM tbDummy" where i temporarily get the data from tbDummy. and upon the event datareport_terminate(), i made sure i closed the dataenvironment as such: Dataenvironment1.rsCommand4_Grouping.Close

What could be wrong there? Thanks for your help p_sie!
0
 

Author Comment

by:jrobles1232000
ID: 10762877
And also, why does it say "Failed getting Rowset(s) from current data source" upon trying to show the datareport the second time?
0
 
LVL 9

Expert Comment

by:p_sie
ID: 10763479
You must open the connection again after changing the connection string!
0
 

Author Comment

by:jrobles1232000
ID: 10764102
if i open it again, another error message appears:

"Invalid SQL statement; expected 'DELETE','INSERT','PROCEDURE','SELECT', or 'UPDATE'."
0
 
LVL 9

Expert Comment

by:p_sie
ID: 10764188
did you open the recordset?

What is the connection state after the change?
0
 

Author Comment

by:jrobles1232000
ID: 10772009
yup, the connection state is 1. but i changed it already. i didn't use a dummy table anymore. i just passed a parameter. thanks neways! =) btw, would you happen to know why whenever i install the software, i keep getting a message saying some of the files are out of date, would you like to have Windows update it for you.. It then prompts me to restart the computer.

Whenever i restart the computer and upon trying to install it again, it keeps saying the same message...

Is there anything i can do to install the software successfully using P&D Wizard?
0
 
LVL 9

Accepted Solution

by:
p_sie earned 500 total points
ID: 10772285
For the last question I have to dig deep in my memory...

I think it has to do with the fact that if a package is made on a XP-machine and then installed on a Win2000 machine...
Possible solutions will be:
- Create package on a system lower then XP (preferebally the lowest OS)
- Or use an installer like Innosetup, with that one you won't have that problem (free download at www.innosetup.com or .org?)
  With innosetup you can import the .lst file of the P&D wizard and then you can make your own adjustments...
0
 
LVL 5

Expert Comment

by:Pi7
ID: 10774687
In which line of code do you get the error "Object not defined"?
0
 

Author Comment

by:jrobles1232000
ID: 10774969
to Pi7, it's upon using the .exe
0
 
LVL 5

Assisted Solution

by:Pi7
Pi7 earned 500 total points
ID: 10775263
From you last post and other posts in this thread,I assume your program runs fine from the VB environment. Right?
If not can you show the code responsible for displaying the report? You mentioned clicking print so I guess You should show the code in the click event of the associated button

Otherwise(i.e if program runs without an error in VB) then you should try using innosetup as p_sie suggested

Regards,
Pi7
0
 

Author Comment

by:jrobles1232000
ID: 10797503
hi, this is the code:

Private Sub cmdPrint_Click()
On Error GoTo cmdPrint_Click_Err:
Dim value As String

If DataEnvironment1.Connection1.State = adStateOpen Then
    DataEnvironment1.Connection1.Close
End If

DataEnvironment1.Connection1.ConnectionString = "Provider=MSDataShape.1;Persist Security Info=False;Data Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\dbAMS\dbCompInventory.mdb;"

If DataEnvironment1.Connection1.State = adStateClosed Then
    DataEnvironment1.Connection1.Open
End If

Call OpenMainConn
   
rsSearch.Open "SELECT * FROM tbSupplier WHERE SupplierName = '" & cboSupplier.Text & "'", CO, adOpenStatic, adLockOptimistic
If rsSearch.RecordCount > 0 Then
        value = rsSearch!Supplier
        DataEnvironment1.Command1_Grouping value
        drSupplier.Show
        'Unload drSupplier
End If
rsSearch.Close
Set rsSearch = Nothing
       
Call CloseRecordSets

cmdPrint_Click_Err_Exit:
    If CO.State = adStateOpen Then
        CO.Close
        Set CO = Nothing
    End If
    Call CloseRecordSets
    Exit Sub
cmdPrint_Click_Err:
    Select Case Err.Number:
        Case 0: Resume
        Case 20: Resume Next
        Case Else:
            Call ViewErr("frmSearch: cmdPrint_Click", Err.Number, Err.Description)
        Resume cmdPrint_Click_Err_Exit
    End Select
End Sub

Btw, in using Innosetup, which directory should i place the .dll and .ocx? How do i make innosetup register it automatically?

Thanks for your help,
jrobles
0
 
LVL 5

Expert Comment

by:Pi7
ID: 10813662
jrobles, I've reviewed your code and based on that code only there's nothing wrong. I suppose that you don't experience any problem when application is run from the vb environment. If this is the case then most probably the erroris caused by manually copying the files to a folder.
0
 
LVL 5

Assisted Solution

by:Pi7
Pi7 earned 500 total points
ID: 10813800
I don't know how you're using inno setup but my advice to you is after you compile you program into an exe file start inno setup and chhose "Create a new script file using the script wizard" option.
As regards this software, I don't know much about it.I only tried is once ( as it was suggested by an expect)and so far so good
0
 

Author Comment

by:jrobles1232000
ID: 10830033
With regards to the error with opening the dataenvironment, i just used an sql statement passing a parameter and it worked.

With regards to the object not defined error, the problem was with the data report designer I used. Notice that there are two of exactly the same Data Report Designer v6.0. The difference lays with the type of .DLL they used. The one that worked for me was MSDBRPTR.DLL. Its working fine now.

After reading up on innosetup, all I had to do in order to register the .DLLs and .OCXs was to put a flag named "regserver".

Thanks so much for your help!
jrobles
0
 
LVL 5

Expert Comment

by:Pi7
ID: 10831163
You're very welcome, jrobles
Thanx
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
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…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Suggested Courses

730 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