1 Attachment(s)
Re: Runtime error 91: object variable or with block variable not set
thanks for the inputs.. i don't think that there is an error with the recordsource and databasename. when the call dispdata on the form_load is disabled, the program works fine without altering the contents of DbfOpen().
please see the attached zip file below. and my apologies for posting "up" on post #11.
Re: Runtime error 91: object variable or with block variable not set
Okay, I'm going to show you something that I think will solve your problems... BUT first let me tell you what I did to your project before I show you this code...
You want to know what I did? NOTHING... :) You already have the reference to get this code to work and it is called, just so you know, DAO ODBC DIRECT!!! (BTW, your reference to DAO 3.51 is what you needed for this...)
Code:
Option Explicit
'declare variables needed to access the records in the *.dbf file...
Dim daoWs00 As DAO.Workspace
Dim daoDb00 As DAO.Database
Dim daoRs00 As DAO.Recordset
Private Sub Form_Load()
'create a DAO ODBC Direct workspace object
Set daoWs00 = DBEngine.CreateWorkspace("Test", "", "", dbUseODBC)
'use workspace object to set database object = to workspace objects opendatabase method
'NOTE: the ODBC DSN "Visual FoxPro Tables" should already be on your system but double check to make sure
Set daoDb00 = daoWs00.OpenDatabase("Visual FoxPro Tables", dbDriverComplete, False, _
"ODBC;DSN=Visual FoxPro Tables;UID=;PWD=;SourceDB=" & App.Path & ";SourceType=DBF;Exclusive=No;BackgroundFetch=Yes;Collate=Machine;")
'okay, select everything from the source table...
Set daoRs00 = daoDb00.OpenRecordset("SELECT * FROM cust1.dbf", dbOpenDynamic)
'and just to prove a point, display a value...
MsgBox daoRs00.Fields("FRANCHISE")
Me.KeyPreview = True
Call DbfOpen 'to open the required databases
'Call DispData 'this bothers me
End Sub
Good Luck
Re: Runtime error 91: object variable or with block variable not set
thanks a lot sir, for your effort. that was too complicated for me to understand lol. believe me, im a total noob with a little background in programming, but somehow i was able to create my desired system little by little.
i just edited this post to reply:
i did integrated your code to my existing work, it did work!!! (standing ovation for you) now, i won't be using those "data control"'s and hide them somewhere. i just learned a new trick in using and opening a dbase IV file. but now i have a new question; can i open several dbase IV files using your sample codes?? assuming to use your code, how can i create index file just like what usually did in foxpro (MS DOS version)(like "INDEX ON ACCOUNT TO ACT")? do i have to create a new post thread for this???
Re: Runtime error 91: object variable or with block variable not set
What I showed you is a Free Table Directory access which is different than a database directory but you should still be able to add indexes via standard sql alter table statements. If not, try the database driver, see the odbc manager under control panel for its name...
Good Luck
Re: Runtime error 91: object variable or with block variable not set
thanks sir. the issue is resolved.