Question about Microsoft Business & Productivity Software

1 Answer

Create access mdb file by vfp code

Can I get sample codes for creation of access mdb file?
for example ,I want to make a table into a mdb database by code using vfp(visual foxpro).

I wait a happy respond.

My email: korea77@nate.com

Posted by on

  • korea77 Oct 15, 2008

    Can I get sample codes for creation of access mdb file?
    for example ,I want to make a table into a mdb database by code using vfp(visual foxpro).

    I wait a happy respond.

    My email: korea77@nate.com

×

1 Answer

Try this

#define dbLogical 1
#define dbNumber 2
#define dbInteger 3
#define dbLongInteger 4
#define dbCurrency 5
#define dbSingle 6
#define dbDouble 7
#define dbDateTime 8
#define dbBinary 9
#define dbText 10
#define dbOLEObject 11
#define dbMemo 12
#define dbReplication 15
#define dbDecimal 16
if file("C:\accesstest.mdb")
delete file c:\accesstest.mdb
endif
public oAccess
oAccess = createobject("Access.application")
oAccess.visible= .t.
newMDB = oAccess.NewCurrentDatabase("C:\accesstest")
newtable = oAccess.CurrentDb.CreateTableDef('testtable')
with newtable
.fields.append(.CreateField("Field1", dbLogical))
.fields.append(.CreateField("Field2", dbNumber))
.fields.append(.CreateField("Field3", dbInteger))
endwith
oAccess.CurrentDb.TableDefs.append( newtable)
dbc2Convert = "\\tpdfiles\data\dfreeman\tip\data\rta\rta"
open database (dbc2convert)

dbgetprop(rta,"table",)

After it runs you will need to close the MDB and reopen it.

Posted on Oct 30, 2008

Add Your Answer

Uploading: 0%

my-video-file.mp4

Complete. Click "Add" to insert your video. Add

×

Loading...
Loading...

Related Questions:

4 Answers

Access database 2003 problem with a copy of database file. How to fix?


You say corrupt, in what way exactly? Do you get any specific error numbers/messages?

Have you tried Access repair program? Compact and Repair. If not, use it. But ensure that you made a backup, it is necessary because all the recovery tips can make the damage even worse.

Also try Jet Compact Utility. This tool created by Microsoft and it is much like Compact and Repair, but more successful in repairing.

If no one of above advice helps, then perhaps you need more powerful solution. In this case try to run a good third-party. I would recommend Recovery Toolbox for Access. It must help you. https://access.recoverytoolbox.com/

Feb 23, 2015 | Microsoft Access 2003 for PC

7 Answers

MS Access database recovery


Have you tried creating a NEW MDB, and then IMPORTING the objects from the Crashed/Corrupted MDB?

This will SOMETIMES serve to rescue most if not all of the corrupted entities .

Or:
You can try:
eRepair Access is a powerful Access database recovery solution for damaged *.mdb and *.accdb files created in Access 2000 and above. Having such a tool at hand immediately after a database file corruption incident may save you a great deal of time, nerve and, of course, an ample amount of money that would otherwise be paid to third-party recovery services. With eRepair Access, you don't need to depend on anyone and entrust your Access data (often quite sensitive) into somebody else's hands. You don't have to wait. You don't have to call it a day knowing that the damaged Access file will not be restored (if at all) until tomorrow. With eRepair Access, you can be back in the game within minutes!

For more information: http://access.erepairtools.com/

If doesn't help, look here: http://www.filerepairforum.com/forum/microsoft/microsoft-aa/access/933-ms-access-database-recovery

Feb 05, 2015 | Microsoft Office Professional 2007 Full...

5 Answers

Access 2007 corrupted database


back up files on external hard drive!! mirror hard drive, will keep corrupted file, it might cause further problems. you have lost some critical files, but you might have isolated a virus . Move on, do a clean install, after reload the backed up files one at a time.

Jan 11, 2015 | Microsoft Office Professional 2007 Full...

1 Answer

Same as above really


Hi,
I have fixed my problem. I realised that the Microsoft Access Database DSN did not include the *.accdb driver. I deleted the existing DSN and created a new one. This allowed me to select the ODBC driver that worked for both file types.

I cameto realise that I was only having this problem on machines that have been upgraded to excel 2007 and not on machines with full virgin installations. On install both try to create the appropriate DSN but one with the same name already exists on the machines being upgraded and the creation fails.

I hope this helps others.

Jul 18, 2009 | Microsoft Excel for PC

7 Answers

Undelete records from access table


ou can try to use third party Access recovery utility to restore your lost and damaged data from .mdb files. For more details about this software:-
Access File Recovery

Apr 17, 2009 | Microsoft Access 2000 (077-01277) for PC

1 Answer

Code for find the Ms access database size using visual basic


The way to get the database size is to point to the directory that the database is do a DIR statement with an output to a file as in DIR payroll.mdb>dbsize.txt and then read from the text file, the first field of the second line being the name (which you really don't need) then the size value of the database.

To import the text files using VB 8 use

'Imports System.Data.OleDb Dim conn As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=d:\path\filename.mdb") Dim cmd As New OleDbCommand("SELECT * INTO [import] FROM [Text;Database=d:\path;Hdr=No].[dbsize.txt]", conn) conn.Open() cmd.ExecuteNonQuery() conn.Close()

Nov 10, 2008 | Microsoft Office Standard for PC

2 Answers

Microsoft Access Problem


You could distribute your tables over a number of databases, and link them back into the original database. To do this, you can use the database splitter to get the initial setup, and then manually move some of the tables from the backen-database to a different database, and reling these moved tables into the original database. Another good idea would be to move the backend storage to be SQL Server rather than Access, which would give you a more stable and more scaleable solution.

Aug 21, 2008 | Microsoft Office 97 Professional Edition +...

1 Answer

About visual basic coding


Hello,
The standard way of creating a database using VBA, which can be modified to suit your needs is this--> Note: the code (wspDefault.CreateDatabase("Newdb.mdb"...), can be altered to save the database in a folder  such as "C:\NEWDB\text.mdb". sub NewDatabase()     Dim wspDefault As Workspace, dbs As Database     Dim tdf As TableDef, fld1 As Field, fld2 As Field     Dim idx As Index, fldIndex As Field     Set wspDefault = DBEngine.Workspaces(0)     ' Create new, encrypted database.     Set dbs = wspDefault.CreateDatabase("Newdb.mdb", _         dbLangGeneral, dbEncrypt)     ' Create new table with two fields.     Set tdf = dbs.CreateTableDef("Contacts")     Set fld1 = tdf.CreateField("ContactID", dbLong)     fld1.Attributes = fld1.Attributes + dbAutoIncrField     Set fld2 = tdf.CreateField("ContactName", dbText, 50)     ' Append fields.     tdf.Fields.Append fld1     tdf.Fields.Append fld2     ' Create primary key index.     Set idx = tdf.CreateIndex("PrimaryKey")     Set fldIndex = idx.CreateField("ContactID", dbLong)     ' Append index fields.     idx.Fields.Append fldIndex     ' Set Primary property.     idx.Primary = True     ' Append index.     tdf.Indexes.Append idx     ' Append TableDef object.     dbs.TableDefs.Append tdf     dbs.TableDefs.Refresh     Set dbs = Nothing End Sub
Hope this helps! Please let me know if you have any questions.Thank You,Raph30

Apr 10, 2008 | Oracle 10g Database Standard (ODBSEONUPP0)

2 Answers

Microsoft Access database


try creating (if you have not already tried) the exact folder tree as [I:\DESKTOPPC\DesktopPC\Database\Toby3]. Now put the file "Tonys_work_be.mdb" into the folder named "Toby3".

Dec 12, 2007 | Business & Productivity Software

3 Answers

Microsoft JET Database Engine error '80040e09'


This worked for me in a similar situation; make a copy of the .mdb file in the same folder. Delete the original .mdb file and rename the copy with the name you used for the original. This should get rid of the read-only aspect. Good luck.

Aug 29, 2007 | Microsoft Office Standard for PC

Not finding what you are looking for?
Business & Productivity Software Logo

Related Topics:

941 people viewed this question

Ask a Question

Usually answered in minutes!

Top Microsoft Business & Productivity Software Experts

Brian Sullivan
Brian Sullivan

Level 3 Expert

27725 Answers

Les Dickinson
Les Dickinson

Level 3 Expert

18299 Answers

Tony

Level 3 Expert

2598 Answers

Are you a Microsoft Business and Productivity Software Expert? Answer questions, earn points and help others

Answer questions

Manuals & User Guides

Loading...