MS Access Question

SP33Demon

Lifer
Jun 22, 2001
27,928
143
106
Hi all,

I was wondering if Access had a way to store separate text files in a database? I don't think it's possible, but maybe somebody knows?

Thanks,

Speed
 

mugs

Lifer
Apr 29, 2003
48,920
46
91
Originally posted by: SP33Demon
Hi all,

I was wondering if Access had a way to store separate text files in a database? I don't think it's possible, but maybe somebody knows?

Thanks,

Speed

If your question is whether or not Access is capable of storing text "files" in a database... the answer is yes. You could store up to 64kb of text in a Memo field, or more than that in an OLE Object field.

If you're asking how to get the text file in there programmatically... I have no idea how to do it with Access/VBA, but it wouldn't be difficult to do with VB.
 

bamacre

Lifer
Jul 1, 2004
21,029
2
81
If you want to export the text file into a table, that's easy. Go to File - Get External Data -Import , and go from there. If you want this updated regularly, you can do a simple macro that would open the table, delete all old info, and import the new text file.
 

DaveSimmons

Elite Member
Aug 12, 2001
40,730
670
126
Google "Access BLOB" (Binary Large OBject) but a memo field will work too. Google should find hundreds of code snapples.
 

austin316

Diamond Member
Dec 1, 2001
3,572
0
0
Originally posted by: DaveSimmons
Google "Access BLOB" (Binary Large OBject) but a memo field will work too. Google should find hundreds of code snapples.

I found that Access has a lot of trouble with storing binary data into a table. Your best bets are to use a memo field if you just want to store alot of text, or if you must store the file, then just upload the file to your server and save the path to it in your database.
 

SP33Demon

Lifer
Jun 22, 2001
27,928
143
106
Originally posted by: austin316
Originally posted by: DaveSimmons
Google "Access BLOB" (Binary Large OBject) but a memo field will work too. Google should find hundreds of code snapples.

I found that Access has a lot of trouble with storing binary data into a table. Your best bets are to use a memo field if you just want to store alot of text, or if you must store the file, then just upload the file to your server and save the path to it in your database.
Thanks for all of the suggestions guys. austin, I was thinking along the same lines as you, because the text will have to be formatted. My last resort was to save the path to the file, but if possible I didn't want to have a bunch of text files floating around! :)
 

EagleKeeper

Discussion Club Moderator<br>Elite Member
Staff member
Oct 30, 2000
42,589
5
0
Originally posted by: SP33Demon
Originally posted by: austin316
Originally posted by: DaveSimmons
Google "Access BLOB" (Binary Large OBject) but a memo field will work too. Google should find hundreds of code snapples.

I found that Access has a lot of trouble with storing binary data into a table. Your best bets are to use a memo field if you just want to store alot of text, or if you must store the file, then just upload the file to your server and save the path to it in your database.
Thanks for all of the suggestions guys. austin, I was thinking along the same lines as you, because the text will have to be formatted. My last resort was to save the path to the file, but if possible I didn't want to have a bunch of text files floating around! :)


Depending on your programming skills, just have one text file and use each record in the access table to contain the description, index for the start and size of the file section. (Similar to like a page break).
 

mugs

Lifer
Apr 29, 2003
48,920
46
91
Originally posted by: EagleKeeper

Depending on your programming skills, just have one text file and use each record in the access table to contain the description, index for the start and size of the file section. (Similar to like a page break).

Wouldn't that be a pain to do an update query on? Assuming you'd want to be able to change the contents of the text files. Any time you changed the length of one "file" you'd have to update the start location of every file that comes after it.
 

EagleKeeper

Discussion Club Moderator<br>Elite Member
Staff member
Oct 30, 2000
42,589
5
0
Originally posted by: mugs
Originally posted by: EagleKeeper

Depending on your programming skills, just have one text file and use each record in the access table to contain the description, index for the start and size of the file section. (Similar to like a page break).

Wouldn't that be a pain to do an update query on? Assuming you'd want to be able to change the contents of the text files. Any time you changed the length of one "file" you'd have to update the start location of every file that comes after it.

It would be a pain. However, it is just a number being offset.
The code will either have to calculate the offsets based on the length of text every time it needs to be accessed, or re-calculate the index starting point of all sub-files after a modification point whenver a modification of size is done.

Seems to be only two ways around the requirement of not wanting multiple text files.

I would personally use multiple text files in a dedicated directory.