Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VB 6, DAO, & FoxPro tables

Status
Not open for further replies.

GMan

Programmer
Aug 19, 1998
4
US
I am trying to use DAO to access Foxpro tables in VB6. Everything is going well, except, I cannot get write access to the fox tables. The code I am using follows. If anyone has any suggestions, please let me know:<br>
<br>
<br>
Sub Test()<br>
<br>
Dim dbs As Database, rstPlayers As Recordset<br>
Dim strName As String<br>
<br>
Set dbs = OpenDatabase("c:\develop\DAOtest", True, False, "FoxPro 2.6")<br>
<br>
Rem this is Read/Write<br>
If dbs.Updatable Then<br>
MsgBox ("DB Read/Write")<br>
Else<br>
MsgBox ("DB Read-Only")<br>
End If<br>
<br>
Set rstPlayers = dbs.OpenRecordset("players")<br>
<br>
Rem this, no matter what I try, is always Read-Only<br>
If rstPlayers.Updatable Then<br>
MsgBox ("Table Read/Write")<br>
Else<br>
MsgBox ("Table Read-Only")<br>
End If<br>
<br>
rstPlayers.MoveFirst<br>
While Not rstPlayers.EOF<br>
strName = rstPlayers!Name<br>
MsgBox (strName)<br>
rstPlayers.MoveNext<br>
Wend<br>
<br>
rstPlayers.Close<br>
dbs.Close<br>
<br>
End Sub
 
GMan,<br>
<br>
Not certain if this applies here, but when using ODBC and DAO, you _must_ define the cursor type in order to accomplish certain ends - such as writing to the table. You might check the parameters list for OpenRecordset() to see if it's necessary to do such for ISAM databases. Also, check to see if you need an entry in either the registry or .ini file.
 
I have tried the following in the type...<br>
<br>
dbOpenTable<br>
dbOpenDynaset<br>
<br>
Which I believe are the only 2 to allow write access... neither worked :( I didn't know that there is an INI file and registry settings that control the behavior of DAO... do you happen to know where I can locate them?<br>
<br>
Thank you<br>

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top