Solved

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

Posted on 2004-04-05
19
669 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
  • 8
  • 6
  • 5
19 Comments
 
LVL 9

Expert Comment

by:p_sie
Comment Utility
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 125 total points
Comment Utility
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
Comment Utility
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
 
LVL 9

Expert Comment

by:p_sie
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
You must open the connection again after changing the connection string!
0
 

Author Comment

by:jrobles1232000
Comment Utility
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
Comment Utility
did you open the recordset?

What is the connection state after the change?
0
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 

Author Comment

by:jrobles1232000
Comment Utility
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 125 total points
Comment Utility
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
Comment Utility
In which line of code do you get the error "Object not defined"?
0
 

Author Comment

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

Assisted Solution

by:Pi7
Pi7 earned 125 total points
Comment Utility
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
Comment Utility
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
Comment Utility
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 125 total points
Comment Utility
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
Comment Utility
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
Comment Utility
You're very welcome, jrobles
Thanx
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

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…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

763 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now