If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Other > Weid dBase IV problem in VB6

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-24-04, 15:26
Triple A Triple A is offline
Registered User
 
Join Date: May 2004
Posts: 9
Weid dBase IV problem in VB6

I have a program that allows the user to select a category from a list box. All items from the category are then retrieved from the database and put into a second listbox. It worked fine until recently. The first listbox is filled correctly but when I want to fill the second one I get the following message:

[img]http://home.wanadoo****/dd.jansen/weirderror.jpg[/img]

I am sure that it is not my code that is causing the problem because it used to work. Maybe something has changed with the database but I can still open it in excel so it hasnt been password-protected.

This is the code I use to open the database:

Code:
Function Compland(SQLQuery As String, Jaar As Integer) As ADODB.Recordset

Dim Database As ADODB.Connection
Dim Bestand As ADODB.Recordset
Set Database = New ADODB.Connection

Database.ConnectionString = "Driver={Microsoft dBASE Driver (*.dbf)};DriverID=277;Dbq=" & databaselocation & ";adLockReadOnly "
Set Bestand = New ADODB.Recordset

With Bestand
    .CursorLocation = adUseClient
    .LockType = adLockReadOnly
    
    'Deze instelling heeft invloed op de snelheid
    'Oude waarde:adOpenStatic
    .CursorType = adOpenForwardOnly
    Call Database.Open
    Set .ActiveConnection = Database
    Call .Open(SQLQuery)
    Set .ActiveConnection = Nothing
End With

Database.Close
Set Compland = Bestand


End Function
I did some more research and I found out that it is possible to select the entire database or separate columns but as soon as I use WHERE the error occurs:

"SELECT * FROM database" works fine
"SELECT * FROM database WHERE column1='value'" doesnt work
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On