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!

Reading External Files

Status
Not open for further replies.

lous

Technical User
Mar 8, 2002
53
0
0
US
Hello,

I have an Access 97 database that will be used by several people at the same time. One of the things needed when a person starts a new record is to automatically fill in their name.

Does anyone know how to make Access read a file on a person's computer (a text file, for example) and fill in that text box with whatever's in that file?

Thanks.
 
Sure - you can Open a file for Input and then use the Inout command to read from the file line by line. Have a look at the example in the Access help file under the topic "Input # Statement"

HTH

Hanging on your every thread

Pete
 
"Input # Statement"

I'm not finding that in Access help.
 
Look for Input and go form there


Input # Statement

Reads data from an open sequential file and assigns the data to variables.

Syntax

Input #filenumber, varlist

The Input # statement syntax has these parts:

Part Description
filenumber Required. Any valid file number.
varlist Required. Comma-delimited list of variables that are assigned values read from the file¾can't be an array or object variable. However, variables that describe an element of an array or user-defined type may be used.
Remarks

Data read with Input # is usually written to a file with Write #. Use this statement only with files opened in Input or Binary mode.
When read, standard string or numeric data is assigned to variables without modification. The following table illustrates how other input data is treated:

Data Value assigned to variable
Delimiting comma or blank line Empty
#NULL# Null
#TRUE# or #FALSE# True or False
#yyyy-mm-dd hh:mm:ss# The date and/or time represented by the expression
#ERROR errornumber# errornumber (variable is a Variant tagged as an error)
Double quotation marks (" ") within input data are ignored.
Data items in a file must appear in the same order as the variables in varlist and match variables of the same data type. If a variable is numeric and the data is not numeric, a value of zero is assigned to the variable.
If you reach the end of the file while you are inputting a data item, the input is terminated and an error occurs.

Note To be able to correctly read data from a file into variables using Input #, use the Write # statement instead of the Print # statement to write the data to the files. Using Write # ensures each separate data field is properly delimited.
 
on the other hand, if you are really going to have (own?) a multiuser db, sooner or later you will get into more demanding requirements. Generally the better approach is to learn the Ms. A. Security maze and apply it. It is a bit daunting to some at fiest, so you should take all the usual precautions (do the implementation on an unnecessary copy at least a couple of times, follow ALL of the directions carefully (as in check list), test thoroughly, then test thoroughly again, and a few more times. Once you are 'comfortable' with the concept and your implementation procedure / check list, start over on the real db/app (after making a back up (again). When the pain is gone, you will have a 'new skill', a bit more confidence, an easy manner of getting the User Name and hte capability to precicely control who does what in your db.




MichaelRed
m.red@att.net

Searching for employment in all the wrong places
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top