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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Connecting to dat file from access or VB

Status
Not open for further replies.

shaiss

IS-IT--Management
Mar 26, 2004
16
0
0
US
Hi there,
I'm trying to connect to a dat file used by auction sentry (popular ebay bid snipping program). I need to have a linked table of some sort, that upon oppening the access database connects to that .dat file. I have the layout for that dat file as it is a fixed width file. The import wizard almost works, but I have to rename the file to .txt file and even then some of the fields come out as #num. Please help!!!

I can do this in either access or VB, please help meee......
 
Hmm. The .dat files I know are MS SQL Server files. Is that what you're dealing with? If so, the best way to do this is to attach the dat(abase) file to a server. If you don't have SQL Server, you can install MSDE, for free and do it that way, though.

Here are some instructions:
Follow these steps for a routine installation:

1. Download MSDE Release A from Microsoft ( 2. Double-click the downloaded package to uncompress it.
3. Open a DOS command window.
4. In the DOS command window, go to the directory the package created (cd c:\MSDErelA or similar, by default).
5. Run this command:
Code:
setup SAPWD="yoursapassword" SECURITYMODE=SQL INSTANCENAME="YourInstanceName" DISABLENETWORKPROTOCOLS=0
6. When setup completes, you can restart the computer so that the MSDE service starts. Alternatively, you can go into Control Panel|Adminstrative Tools|Services and start MSSQLSERVER and/or MSSQL$<yourinstancename> and SQLAgent$<yourinstancename>. screenshot: start_services.jpg

To verify that your installation succeeded, go to the DOS command window and try:

Code:
osql -S (local)\yourinstancename -U sa -P yoursapassword

To restore the dat file as a database, do this:
Code:
RESTORE DATABASE newdb FROM DISK = 'c:\path\to\backupfile.dat'
go

then run these commands:
Code:
sp_databases
go

If everything is working, the default MSDE databases should be displayed.

To connect an adp to this, go to File|Connection and fill out the following fields:
1. (local)\YourInstanceName
2. User Name: sa, Password, the password you used above
3. the database name you used above

Once you do this,you should see the tables in the database window.

I hope this helps.

Jeremy

---
Jeremy Wallace
METRIX Lead Developer
Fund for the City of New York
http:// metrix . fcny . org
 
All MS SQL servers that I work with create MDF and LDF (log) files.

Have you tried to google "auction sentry dat connect"?

Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
Thanks JeremyNYC, I will try this when I get home. Seems like access should just easily be able to read the dat file. But it doesn't surprise that MS would make it complicated.

Do you know if I use your meathod, will the DB updated in real time? Or do you need to hit a "refresh button"?

dhookom: nothing came up by that search, I've spent hours looking, but thanks again!!!
 
I would bet good money that the files are not SQL Server databases. You stated "I have the layout for that dat file as it is a fixed width file". That combined with the extension of "DAT" removes SQL Server databases from a list of types.

Why would say MS is making this complicated. It seems to me the issue is with "auction sentry". If an application creates a database type application with their own format, why would MS be expected to support the new format?

Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
thanks dhookom,
True MS shouldn't support it. But if the dat file is just a flat file it shouldn't be complicated to import it. What I don't understand is why I'm getting the #num error. I'll post some screen shots later.

I guess thats my main problem, the #num error. I can create the link fine to the txt file. But it would be nice if jermeys method works and you can just connect it to the original dat file. And even progam the form (or module) to detect changes and auto update the table.

The other problem is what you said. Auction sentry doesn't make it easy to read the dat file. But technically, a dat, ini, and txt file are all the same.

Thanks again
 
I don't think Jeremy's suggestion is worth trying since SQL Server uses MDF files and would certainly not have recognizable text.

You might be able to write your own code to import the records if you can't import using wizards etc.

Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top