473,385 Members | 1,396 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

access 97 : importing text files with vb

i had some problems trying to alter this code in order to import
different text files into the access 97 program.
it works properly however the users will be selecting different
types of text files. for instance, the prefix will be stored in the
cboAcct (combo box), ie BC, DB, AF, EG.
so if i tried to contenate the string, it would be cboAcct "_DDA_CR" .
but instead, the code
imports and creates a new table called "_DDA_CR" instead of a new
table called "BC_DDA_CR."
does anyone know what i am missing in the code?

thanks in advance,- jung.
Dim InDialog As Office97Dialog

With InDialog
.hwndOwner = Application.hWndAccessApp
.strDlgTitle = "Import DDA Credit Files"
.strOpenTitle = "Import"
.strFilter = "Text (*.txt)|"
.strFile = ""
.strInitialDir = "C:\Program Files\RECON\RNDI"
End With

If UseFileDialog(InDialog, True) = 0 Then ' (success; a file has
been chosen)
DoCmd.SetWarnings False

DoCmd.TransferText acImportDelim, "DDA_CR Import
Specification", cboAcct & "_DDA_CR", Trim(InDialog.strFile), True
DoCmd.OpenTable cboAcct & "_DDA_CR", acViewNormal
DoCmd.SetWarnings True
MsgBox "Import process is now complete.

End If
Nov 12 '05 #1
3 6587
DoCmd.TransferText acImportDelim, "DDA_CR Import Specification",
cboAcct & "_DDA_CR", Trim(InDialog.strFile), True
DoCmd.OpenTable cboAcct & "_DDA_CR", acViewNormal


How about this... instead of

dim strDestTable as string

strDestTable = cboAcct & "_DDA_CR"

DoCmd.TransferText acImportDelim, "DDA_CR Import Specification",
strDestTable, Trim(InDialog.strFile),True

DoCmd.OpenTable strDestTable,acViewNormal
Nov 12 '05 #2
pi********@hotmail.com (Pieter Linden) wrote in message news:<bf**************************@posting.google. com>...
DoCmd.TransferText acImportDelim, "DDA_CR Import Specification",
cboAcct & "_DDA_CR", Trim(InDialog.strFile), True
DoCmd.OpenTable cboAcct & "_DDA_CR", acViewNormal


How about this... instead of

dim strDestTable as string

strDestTable = cboAcct & "_DDA_CR"

DoCmd.TransferText acImportDelim, "DDA_CR Import Specification",
strDestTable, Trim(InDialog.strFile),True

DoCmd.OpenTable strDestTable,acViewNormal


thanks again pieter. it imports well but the code did not add the
cboacct value in front of the "_dda_cr."

jung
Nov 12 '05 #3
Try putting a "MsgBox Me!cboAcct" just ahead of the concatenation. If,
despite all this, it is concatenating nothing to the "_DDA_CR", then it's
clear that the Combo box either has no value or is not being properly
addressed.

The code just doesn't often "decide to ignore one of the values".

Larry Linson
Microsoft Access MVP
"JMCN" <pi******@yahoo.fr> wrote in message
news:27**************************@posting.google.c om...
pi********@hotmail.com (Pieter Linden) wrote in message

news:<bf**************************@posting.google. com>...
DoCmd.TransferText acImportDelim, "DDA_CR Import Specification",
cboAcct & "_DDA_CR", Trim(InDialog.strFile), True
DoCmd.OpenTable cboAcct & "_DDA_CR", acViewNormal


How about this... instead of

dim strDestTable as string

strDestTable = cboAcct & "_DDA_CR"

DoCmd.TransferText acImportDelim, "DDA_CR Import Specification",
strDestTable, Trim(InDialog.strFile),True

DoCmd.OpenTable strDestTable,acViewNormal


thanks again pieter. it imports well but the code did not add the
cboacct value in front of the "_dda_cr."

jung

Nov 12 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Joel | last post by:
Hi, I'm importing our DOS data base (Dataflex) to Mysql I have a table with 174,638 records that I convert into a tab delimetered Text file however, Mysql only reads 87,035! I checked the text...
2
by: Debbie CD UK | last post by:
I have a large amount of log files from an electronic contro tester that I need to import in to an Access database Unfortunately, they are not comma delimited or fixed with but different fields...
3
by: Praetorian Prefect | last post by:
Code will not work in XP. Any ideas? Public Sub GetData() ' Declare variables Dim InputDir, ImportFile As String, tblName As String, strsql As String InputDir = ("f:\") ImportFile =...
2
by: Regnab | last post by:
Just chasing a few ideas for a suitable loop for importing multiple text files. Up until now I have used a Do While Len(strfile) > 0 and moved each file to a different folder after being imported....
4
by: mohsin74 | last post by:
Hi there, I have a data in text files. I need to write some macros / vba to import into Excel . The text files is base on command syntax, as this format; Command-X; Data1 Data2 Data3...
1
by: jith87 | last post by:
hi guys, i need to automate the process of importing txt files in a folder into the same table in access.i have created a macro todo the job.the following are the probelms that i face: 1....
5
by: MLH | last post by:
I'm using A97 import data wizard to import text file N2 a table. The text file is a DIR listing produced by running dir jdc*.* /s c:\JDCs.txt The wizard is chopping the lines off at the...
4
by: chimambo | last post by:
I have 2 problems: 1. I want to import a single text file into an access table using a Macro. I am however getting an error that I need to put a specification name argument. What does this mean?...
1
by: aconti74 | last post by:
Hello I am new to vba programming/coding. I am writing a program that goes through a directory of text files and imports them into the database. The problem is eventually the database gets to big...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.