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

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

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
jrobles1232000
Asked:
jrobles1232000
  • 8
  • 6
  • 5
4 Solutions
 
p_sieCommented:
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
 
p_sieCommented:
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
 
jrobles1232000Author Commented:
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
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
p_sieCommented:
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
 
jrobles1232000Author Commented:
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
 
jrobles1232000Author Commented:
And also, why does it say "Failed getting Rowset(s) from current data source" upon trying to show the datareport the second time?
0
 
p_sieCommented:
You must open the connection again after changing the connection string!
0
 
jrobles1232000Author Commented:
if i open it again, another error message appears:

"Invalid SQL statement; expected 'DELETE','INSERT','PROCEDURE','SELECT', or 'UPDATE'."
0
 
p_sieCommented:
did you open the recordset?

What is the connection state after the change?
0
 
jrobles1232000Author Commented:
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
 
p_sieCommented:
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
 
Pi7Commented:
In which line of code do you get the error "Object not defined"?
0
 
jrobles1232000Author Commented:
to Pi7, it's upon using the .exe
0
 
Pi7Commented:
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
 
jrobles1232000Author Commented:
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
 
Pi7Commented:
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
 
Pi7Commented:
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
 
jrobles1232000Author Commented:
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
 
Pi7Commented:
You're very welcome, jrobles
Thanx
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 8
  • 6
  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now