Sep 21st, 2000, 04:49 PM
Ok, been banging my head and now I need to ask someone for some help. Hopefully someone will have an idea.
Have an application that simply reads certain fields out of an Access database and sends that information out to a text file. It uses datepickers so that I can pull out these certain fields based on the date range selected.
I have Visual Studio with the service pack 4. On my computer (running Win 98) where I am writing the app it works perfect. I used the Package and Development wizard to create an installation program. When I take the install program to another computer with win 98 and 95 (tried 2 different ones) the install program runs fine. In the app I have a button that starts the export, on the other computers, when the button is clicked, I get "error 91, Object variable or With block variable not set".
Is there something that is missing when the setup program is created? Why is it working on my machine? What do I need to do to the other machines? Just to try things I have installed DCOM 98 and MDAC 2.5 on the other machines. Below is the main part of the code that I have. This works perfectly on my computer.
Thank you if anyone can give me insight!
Dim ws As Workspace
Dim db As Database
Dim strsql As String
Dim strDBName As String
strDBName = "C:\aloha\backoffice\ds\dsdata.mdb"
Set ws = DBEngine.Workspaces(0) 'use default
Set db = ws.OpenDatabase(strDBName)
'Create sql statement
strsql = "SELECT Customers.LastName, Customers.FirstName,_ Customers.CardNumber,ARTransactions.TransactionReference,_ ARTransactions.TransactionDate,ARTransactions.TransactionTotal INTO [text;database=c:\aloha\].[stjoseph.txt] FROM [Customers]INNER JOIN [ARTransactions] ON Customers.CustomerID = ARTransactions.TransactionCustomerID WHERE ARTransactions.TransactionDate BETWEEN #"
strsql = strsql & CStr(DTPicker1.Value - 1)
strsql = strsql & "# AND #"
strsql = strsql & CStr(DTPicker2.Value + 1)
strsql = strsql & "#"
With db
.Execute strsql
End With
Have an application that simply reads certain fields out of an Access database and sends that information out to a text file. It uses datepickers so that I can pull out these certain fields based on the date range selected.
I have Visual Studio with the service pack 4. On my computer (running Win 98) where I am writing the app it works perfect. I used the Package and Development wizard to create an installation program. When I take the install program to another computer with win 98 and 95 (tried 2 different ones) the install program runs fine. In the app I have a button that starts the export, on the other computers, when the button is clicked, I get "error 91, Object variable or With block variable not set".
Is there something that is missing when the setup program is created? Why is it working on my machine? What do I need to do to the other machines? Just to try things I have installed DCOM 98 and MDAC 2.5 on the other machines. Below is the main part of the code that I have. This works perfectly on my computer.
Thank you if anyone can give me insight!
Dim ws As Workspace
Dim db As Database
Dim strsql As String
Dim strDBName As String
strDBName = "C:\aloha\backoffice\ds\dsdata.mdb"
Set ws = DBEngine.Workspaces(0) 'use default
Set db = ws.OpenDatabase(strDBName)
'Create sql statement
strsql = "SELECT Customers.LastName, Customers.FirstName,_ Customers.CardNumber,ARTransactions.TransactionReference,_ ARTransactions.TransactionDate,ARTransactions.TransactionTotal INTO [text;database=c:\aloha\].[stjoseph.txt] FROM [Customers]INNER JOIN [ARTransactions] ON Customers.CustomerID = ARTransactions.TransactionCustomerID WHERE ARTransactions.TransactionDate BETWEEN #"
strsql = strsql & CStr(DTPicker1.Value - 1)
strsql = strsql & "# AND #"
strsql = strsql & CStr(DTPicker2.Value + 1)
strsql = strsql & "#"
With db
.Execute strsql
End With