How Can I Read A Text File Into A Database
Jan 4, 2005
This is what I would like to achieve
Each time a person comes into our building, they use a electronic key. The information is recorded into a text file. I would like to extract information as described next
The date from the line marked D. Date is marked in bold
The time from the line marked T. Time is marked in bold
The key number and Location from the line marked M. Key Number & Location is Marked in Bold
Sample of the text file:
D[ Fri 30/04/04 ]
T[ 08:19 ]
M[ Valid key:130 Ing group, tenancy:SUNCITY, door:Lower Roller Dr, panel:SURF CITY. ]
N[ 0 2 0 0 5 23 1 0 0 0 130 2 ]
D[ Fri 30/04/04 ]
T[ 08:22 ]
M[ Valid key:20 LEAD NGUYANST, tenancy:SUNCITY, shaft:0, panel:SURF CITY. ]
N[ 0 1 0 0 5 16 1 0 0 0 20 2 ]
D[ Fri 30/04/04 ]
T[ 08:23 ]
M[ Valid key:556 Ing Group, tenancy:SUNCITY, door:Lower Roller Dr, panel:SURF CITY. ]
N[ 0 2 0 0 5 23 1 0 0 0 556 2 ]
…..and so on the text goes
I am reasonably familiar with access but I have not had any experience with Text Files . Could someone post a sample db that would give me a starting point. any information would be appreciated.
Phil.t
View Replies
ADVERTISEMENT
Nov 5, 2013
I have a text file that I am using VBA to read and print 2 pieces of data to another text file.The code works to a point, in some instances it does not appear to find the end of file but captures and writes all the data. Or, after printing 36 lines correctly, it then stops writing.
I have stepped through the code and it appears to be capturing the data up past this issue but for what ever reason it does not print it to my text file.
PHP Code:
Option Compare DatabaseOption Explicit    Public Mode As String    Public FUNDREF As String   Â
Public rst As String Function DAILYAUDITTRAIL()     Close #1    Close #2      Open "C:UsersTEST IN.TXT" For Input As #1   Â
Open "C:UsersTEST OUT.txt" For Output As # 2      Do While Not EOF(1)    Â
Line Input #1, rst     If rst Like "KM56Aasdf*" Then        FUNDFINDER   Â
End If     Loop  End FunctionFunction FUNDFINDER()         Â
[code]...
View 3 Replies
View Related
Oct 8, 2013
For weeks I am trying to read an XML file which needs to be processed in an Access database. I can not find the proper way to:
- find a specific node
- iterate from there
The XML file is an international bank file:
Code:
<?xml version="1.0" encoding="utf-8"?>
<Document xmlns="urn:iso:std:iso:20022:tech:xsd:pain.008.001.02" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<GrpHdr>
<MsgId>001-2013-09-19-18:12:17</MsgId>
[Code] ....
I started quite simple, just wanted to read to node MsgId. This is the code I use:
Private Sub ReadXML_Click()
Dim aDoc As DOMDocument60
Dim aNode As IXMLDOMNode
Set aDoc = New MSXML2.DOMDocument60
aDoc.async = False
aDoc.Load DLookup("C:Sample.XML")
[Code] ....
Whatever I try: //MsgId or MsgId the results is "No nodes". How to read to XML.
Besides reading one node, the next challenge will be iterating the PmtInf node. There can be 1 in the XML file but also 50.
View 12 Replies
View Related
Jun 19, 2013
I would like the label for a text box to read "B&W or Color" for a database of photographs.
Access will not accept the ampersand. Since this is just a label, I thought I could get away with using this symbol.
Is there a way to get the label to accept the ampersand?
View 1 Replies
View Related
Oct 19, 2006
I'm using Access 2000. When I click the File menu to go to a recently used file, the entire path is shown. With my file system, the File drop down widow is about 50 characters too short to show the entire path all the way out to where I keep my database. Is there a way to shut off the viewing the entire path "feature?"
View 2 Replies
View Related
Aug 19, 2013
We have a function that will allow a user to navigate to a text file and import it to a database. I've been asked to make it import ALL the text files from all sub-directories in the directory IF they've never been imported before (based on FileName and LastModifiedDate). I've set up a table to track what's getting imported (tbl_ImportHistory). I'm thinking what I need to do is use the previous coder's GetFileName function in a recursive loop removing the navigation request and adding the comparison and then, if it imports the file, the name and date need to be added to the tbl_ImportHistory table. But I'm completely unsure of how to do it.
I'm posting the GetFileName function below. I believe once I've got it modified the rest of the code can be left intact as it just parse's and loads whatever file is selected in the GetFileName function.
<code>
Function GetFileName() As String
Dim fd As FileDialog
Set fd = Application.FileDialog(msoFileDialogFilePicker)
fd.AllowMultiSelect = False
Dim vrtSelectedItem As Variant
[code]....
View 5 Replies
View Related
Sep 9, 2014
I am way beyond my skills trying to read these files.
I am trying to read *.pdf files using VBA. I have tried using some code
Code:
Dim AcroApp As Acrobat.CAcroApp
Dim theForm As Acrobat.CAcroPDDoc
Dim jso As Object
Dim text1, text2 As String
'error occurs here stating"ActiveX component can't create object"
[Code] ....
I have set a reference to Adobe 10 Type Library and Adobe Access 3 Type library. I am using Adobe Acrobat Reader X. I now read them by converting to text file and using FileObject to read the text file and VBA text commands to get the right fields.
View 9 Replies
View Related
Feb 13, 2014
Let's say I have a database saved in Folder 1. Is there a way for me to create a read-only copy of that database in Folder 2 so that it can be up-to-date with the changes made in the Folder 1 database? I am running Windows 7.
View 10 Replies
View Related
Nov 3, 2005
I have a Front-End Access Data Project file (ADE compiled format for distribution) that I purposely have the Read-Only file attribute set to True.
I've been using it this way for about 7 years starting with Access 97 and the current version is 2000.
I am upgrading the app to 2003 now and everything with the conversion is fine except when I set the Read-Only file attribute to True it all of a sudden when starting it no longer connects to the Back-End (sql server) and displays a "form load cancelled" error before hanging.
If I disable the Read-Only attribute, everything is fine again, but I prefere not to do this because that will require me to rework my auto updater.
I use it this way because it prevents bloating of the file and allows for my auto updater to determine new version by using the file modification date.
Any Idea's?
View 1 Replies
View Related
Apr 3, 2006
Within Access 2000 is there some VBA code i can use to remove the read only status of a MS Excel spreadsheet?
Regards,
Neil
View 1 Replies
View Related
Oct 23, 2014
I'm getting an error when trying to read a .txt file into an array for processing. The error and a snippet of the code are below.
Run-time error '9'
Subscript out of range
Dim iFileNum As String
Dim strLineInfo()
Dim i As Integer
Dim strExpensesFile As String
strExpensesFile = "c:FinanceExpensesIn.Txt"
[Code] .....
View 9 Replies
View Related
Aug 1, 2006
I'm currently creating an interface program for a MS Access database. I've only used Access once in the past but used other DB's a handful of times so I didn't have any trouble getting the general program created. My issue arose when I tried to make it so that the users needing to use the program can just copy the .exe and the .mdb files and use it.
The program doesn't require users to share the database but to store their OWN programs information in their OWN database, so basically each needs to have their own database with the exact same design (but different data). The original plan was to just get them to copy over a near empty .mdb with the design set up and have them slowly create their own dataset with it. However, upon copying these files between my computer and others it ends up allowing my interface program to retrieve data from the DB but not write any new entries to it. All security permission on the file itself are set to allow read/write to everyone so I'm not sure what's causing this. Is there any other security settings I should worry about? Everything I could find within access seemed to be set so that it could be used freely so I'm not sure what the problem is. Any help would be greatly appreciated.
P.S. - I apologize if there is already a related topic in existence, I am new to these boards and tried to search beforehand for any information on this topic but came up empty handed so decided to start my own topic about this problem.
View 4 Replies
View Related
Oct 17, 2014
Was wondering how i can import data from a file to a table in different fields. The data inside the file is described with the number of characters and space's between. The attached file has the data.
For example in the file attached, the first four characters represent a data like 'ticket number' and maybe the third line 6 to 10 charcaters represent 'name of a passenger'.
Now how do i import these data to a table into respective fields in a table.
View 14 Replies
View Related
Feb 26, 2014
I have an access program that is stored on a SharePoint site. I want to be able to export report to the computer even if I just open the access program as read only. Here's my code:
Code:
Private Sub btnExport_Click()
On Error GoTo btnExport_Click_Err
Dim db As DAO.Database
Dim strSQL As String
Dim qdfTemp As DAO.QueryDef
Dim qryFilter As DAO.QueryDef
[code]...
View 2 Replies
View Related
Jan 22, 2008
Hi,
I have 2 text boxes in a form. In first box a sentence is appearing and second text box is unbound.
In second text box, I need to read only first word of a sentence appeared in a first text box.
How can I do it?
Please advise.
With kind regards,
Ashfaque
View 14 Replies
View Related
Feb 11, 2013
Does a (the) .ldb file have to be closed for another user on a network (separate FE linked to network drive BE) to read/write info to a table? Or even select info from a table?
View 6 Replies
View Related
Sep 6, 2006
Hi Guys, I am willing to design a form where I could browse the files and a button should read from text file and insert values into my Table. Please help me in this regard.
I want to have a function with parameters like text file name and destination table. Any clue will be highly appreciated
Cheers
Abid Hussain
View 4 Replies
View Related
Jul 12, 2006
Hi, I am trying to create a database from scratch, however I need multiple users to have access to it. I do this nearly everyday and have no issues on the LAN we use.
This week I have been struggling to create a database on a different LAN. I create the database however I get the message that it is read only when I close it and enter it again. This means that other people are also unable to open it at the same time, and when they managae, they only get read only access.
Could this be a strange unfamilar-to-me LAN set up? Or is there something fundamental that I am not doing when creating this database?
Thanks for any help
View 1 Replies
View Related
Jul 17, 2007
hello,
You helped me solve my linking issue with my front-end/back-end database, but I've got another question. Whenever I open up the front-end ( the shortcut to it anyway), I can't open it in edit mode- only edit. Even if I do a fileopen and select the type of open I want, it doesn't work. How do I open it in edit mode so I can link the table?
thanks again
View 4 Replies
View Related
Feb 13, 2006
Hi All,
I created a database in Access and of course password protected the backend version. As a matter of course I backed up the mdb to cd in case of emergency.
Our network has been taken down due to some virus being bought in by a laptop user so I wanted to reinstall the mdb from the cd to my c: drive.
The problem is that the file is saying that it is 'Read Only' which I think is down to the password protection i put on there.
Question:
Is there a way I can get round the security?
I promise I am not a hacker!
Cheers
Smudger
View 2 Replies
View Related
Jun 29, 2006
I would like to tweak my database so that when it opens for the users it will not show the minimize, maxamize, and close buttons at the top. Also, I would need code that will maximize my forms automatically. Let me know if this is not a good idea? I am trying to eliminate someone thinking that the close button will act as a cancel button. I dont want them to save information on accident since access saves automatically! (I already have a close without saving button on every form but people are used to closing document to not save them)
View 6 Replies
View Related
Jun 19, 2007
I have a database running for the last 6 or so years (A97) and have the ctl-shift disable enable code in it to stop people tinkering about with it.
The database was aparently working fine yesterday and today it's decided to be read-only so no-one can update the data.
It's on a server - all permissions ok and not read-only.
I can't get the disable/enable code to work either. So basically, it's locked for any development changes and it's locked for any data changes.
The IT boys are going to take a backup from the tapes of the server and re-install it, so it should be ok, but I've never had this happen before and the database is used daily for the last 6 years with no problems.
Any speculative thoughts?
[edit] I have done a search and couldn't find anything that fitted the situation
Thanks
Col
View 9 Replies
View Related
Nov 16, 2004
How do you make an Access database able to have records written to it (NOT read only)?
View 2 Replies
View Related
May 4, 2005
I am having problems with ODBC Access data source name. When I want to display some database data in a html table on a webpage there is no problem. But when I send data from a html form to the database I get an OLE DB error. (I am using ADO). I can't remember the message exactly but it was something like
Microsoft OLE DB Provider for ODBC drivers error '80004005'
[Microsoft][ODBC Microsoft Access driver] The command must be execute on a query which can be edited.
insert.asp, line 50
For some reason my database is read-only. And I don't want that. I tried
1. ODBC administrator deleting and creating a fresh System DSN, checked if there Read-Only wasn't marked on.
2. Deleted my browser cache.
3. Restarted computer several times again
4. Installed MDAC 2.8 again.
btw. I have created the table with MS Access XP and i am using Windows XP.
Below is my code.
[code]
<FORM ACTION="insert.asp" METHOD="post">
Barcode: <INPUT TYPE="text" NAME="a1" SIZE="15"><BR>
Artist: <INPUT TYPE="text" NAME="a2" SIZE="40"><BR>
Album: <INPUT TYPE="text" NAME="a3" SIZE="50"><BR>
<INPUT TYPE="submit" VALUE="Send">
<INPUT TYPE="reset" VALUE="Clear"><BR>
</FORM>
<%
a1 = request.Form("a1")
a2 = request.Form("a2")
a3 = request.Form("a3")
if ((a1 <> "") and (a2 <> "")) or ((a1 <> "") and (a3 <> "")) then
Set db=Server.CreateObject("ADODB.Connection")
db.ConnectionTimeout=40
db.Open "DSN=pieter", "admin"
sql = "INSERT INTO albums VALUES ('"&a1& "','"&a2& "','" &a3& "')"
Set rs = Server.CreateObject("ADODB.Recordset")
<----- Here is the error ----> db.execute sql
db.close
Set db=Nothing
end if
%>
[code]
View 2 Replies
View Related
Jun 8, 2015
The database I am working with suddenly says that is ready only, and I cannot make changes! How can I make it not read only?
View 2 Replies
View Related
Oct 14, 2014
I have a FE DB that I have been opening and closing at various times without incident. Now all of a sudden it only opens as READ ONLY. I can't find anyone with a BE open that might be causing this. What will cause this? If I save a copy and then replace the original will I lose my data?
View 6 Replies
View Related