More details, please.
--
Ken Snell
<MS ACCESS MVP>
"importing data" <importing da...@discussions.microsoft.com> wrote in message
news:21D0865E-3CDD-4395...@microsoft.com...
Create a form (name it "HiddenForm") that has a single textbox (unbound) on
it (name the textbox "txtFile").
Create the two macros shown below. Change arguments' information to match
your setup.
To run the process, you would run MacroStart.
----
MacroName: MacroStart
Condition: (none)
Action: OpenForm
Form Name: "HiddenForm"
Mode: Hidden
Condition: (none)
Action: SetValue
Expression: Dir("C:\MyFolder\*.txt")
Control Name: Forms!HiddenForm!txtFile
Condition: (none)
Action: RunMacro
Macro Name: MacroGet
Repeat Expression: Len(Forms!HiddenForm!txtFile & "") > 0
Condition: (none)
Action: Close
Object Type: Form
Object Name: HiddenForm
(end of MacroStart)
----
MacroName: MacroGet
Action: TransferText
File Name: ="C:\MyFolder\" & Forms!HiddenForm!txtFile
(other arguments as appropriate)
Action: SetValue
Expression: Dir()
Control Name: Forms!HiddenForm!txtFile
(end of MacroGet)
--
Ken Snell
<MS ACCESS MVP>
"Rob T" <Rob T...@discussions.microsoft.com> wrote in message
news:2A00C2DC-EC84-42C7...@microsoft.com...
The Dir function can be used to return a list of files without extensions,
but the way that is done will also return all other files that are in that
folder. In this situation, you'd change the
Expression: Dir("C:\MyFolder\*.txt")
to
Expression: Dir("C:\MyFolder\*")
However, ACCESS will not allow you import a text file unless it has specific
file extensions. It definitely will fail if you try to import a file with no
extension. So you will need to have those extensions on the files for this
to work. Or you'll need to change the extensions that ACCESS can use (see
http://support.microsoft.com/default.aspx?scid=kb;en-us;304206). I would
recommend that you add the ".txt" extension to the files. This can be done
via a simple VBA function if all files in the folder need to have ".txt"
added to the end of them.
----
MacroName: MacroStart
Condition: (none)
Action: OpenForm
Form Name: "HiddenForm"
Mode: Hidden
Condition: (none)
Action: SetValue
Item: Forms!HiddenForm!txtFile
Expression: Dir("C:\MyFolder\*.txt")
Condition: (none)
Action: RunMacro
Macro Name: MacroGet
Repeat Expression: Len(Forms!HiddenForm!txtFile & "") > 0
Condition: (none)
Action: Close
Object Type: Form
Object Name: HiddenForm
(end of MacroStart)
----
MacroName: MacroGet
Action: TransferText
File Name: ="C:\MyFolder\" & Forms!HiddenForm!txtFile
(other arguments as appropriate)
Action: SetValue
Item: Forms!HiddenForm!txtFile
Expression: Dir()
(end of MacroGet)
--
Ken Snell
<MS ACCESS MVP>
"Rob T" <Ro...@discussions.microsoft.com> wrote in message
news:629910BA-E67B-4E32...@microsoft.com...
item: [Forms]![HiddenForm]![txtFile]
expression: Dir("C:\Documents and Settings\rthiemann\My Documents\Water
Recovery\Banner Data\MeterData\*.txt")
any suggestions?
Your path to the file is a bit unusual. Are you using the My Documents
standard folder as the "root"? If yes, the path should be this, I think:
"C:\My Documents\Water Recovery\Banner Data\MeterData\*.txt
Otherwise, put a text file in the C drive's main folder, and let's see if it
works that way:
"C:\MyTextFileName.txt"
--
Ken Snell
<MS ACCESS MVP>
"Rob T" <Ro...@discussions.microsoft.com> wrote in message
news:A173D537-A241-4BAC...@microsoft.com...
You may have a reference problem. Try following these steps (from a post by
Douglas Steele, MVP):
This can be caused by differences in either the location or file version of
certain files between the machine where the application was developed, and
where it's being run (or the file missing completely from the target
machine). Such differences are common when new software is installed.
On the machine(s) where it's not working, open any code module (or open the
Debug Window, using Ctrl-G, provided you haven't selected the "keep debug
window on top" option). Select Tools | References from the menu bar. Examine
all of the selected references.
If any of the selected references have "MISSING:" in front of them, unselect
them, and back out of the dialog. If you really need the reference(s) you
just unselected (you can tell by doing a Compile All Modules), go back in
and reselect them.
If none have "MISSING:", select an additional reference at random, back out
of the dialog, then go back in and unselect the reference you just added. If
that doesn't solve the problem, try to unselect as many of the selected
references as you can (Access may not let you unselect them all), back out
of the dialog, then go back in and reselect the references you just
unselected. (NOTE: write down what the references are before you delete
them, because they'll be in a different order when you go back in)
For far more than you could ever want to know about this problem, check out
http://members.rogers.com/douglas.j.steele/AccessReferenceErrors.html
--
Ken Snell
<MS ACCESS MVP>
"Rob T" <Ro...@discussions.microsoft.com> wrote in message
news:FA66C243-9EFA-4BB5...@microsoft.com...