Re: Recording Data from a VBA macro

Tech-Archive recommends: Fix windows errors by optimizing your registry



Start with Google. Search for SQL, VBA, ADO, and go from there.



"red6000" <red1000002001@xxxxxxxxx> wrote in message
news:44738450$0$18251$ed2619ec@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Thanks Jezebel,

I'm new to Access, could you point me in the right direction on how I can
wrtie the data directly into the database?

Thanks again.


"Jezebel" <warcrimes@xxxxxxxxxxxxxx> wrote in message
news:%23b42KJrfGHA.4568@xxxxxxxxxxxxxxxxxxxxxxx
Write the data directly to the database. Access databases are mulituser
(on a small scale, at least).



"red6000" <red1000002001@xxxxxxxxx> wrote in message
news:44737f59$0$563$ed2619ec@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hi,

I have a macro with many userforms and have some code that records
whether each checkbox or optionbutton was selected. This data is then
stored as a string called MIDATA and added to a text file (and then this
text file is linked into an Access database)

The problem I have is that if 2 people run the code at exactly the same
file, the text file is ready-only. Is there a better way to record the
data in a file that can be accessed by multiple people. My code at the
moment is:

ChangeFileOpenDirectory _
"J:\MACRO MI\"
Documents.Open FileName:="MacroMI.txt"
Documents("MacroMI.txt").Activate
Selection.EndKey Unit:=wdStory
Selection.TypeParagraph
Selection.TypeText Text:=MIDATA
If ActiveDocument.ReadOnly = False Then
ActiveDocument.Save
End If
ActiveDocument.Close

I have thought about having some 'other' text files that the code can go
to if the main one is 'read-only', but this seems messey

Thanks for any help or pointers.







.


Quantcast