Get Table Names From Another Database File VB Code

Nov 6, 2013

I'm trying to find all the table names from another database file using VB code. This is what i have so far:

Code:
Function getFileNameOpen(path) As String
Dim f As Object
Dim varFile As Variant
Set f = Application.FileDialog(3)

[Code] ....

This function will show a browser window so that the user can select a file, and returns the file path.

Code:
Function OpenFile()
Call getFileNameOpen(path)
Dim db As Database
Dim td As TableDef
Database = path

[Code] ....

I have this function. I need to get all the table names from the selected access file into a list so I can do a for loop after.

I can't figure out how to set the CurrentDb() to the path one. This code gives me the table names and some other names of stuff which I don't know what they are. But for the current database not the one in the path.

View Replies


ADVERTISEMENT

Modules & VBA :: Code To Store PDF File Names In The Combobox?

Mar 11, 2014

I have a folder in which there are PDF files stored. Now in the Form, there is a combobox and I want the code so that when a Form is loaded then add all those PDF file names(only first 9 letters of that) in the combobox.

e.g if the PDF file name is ABCDE1990-YYY then add ABCDE1990 in the combobox. So if there 10 PDF files in the folder then add 10 names in the combobox.

View 5 Replies View Related

General :: Code To Remove Spaces From Table Names

Jan 27, 2015

We use a Database which has been constantly developed over 10 years using earlier versions of Access2003.We have Upgraded to Access 2013 and we are experiencing many conversion issues which I need to resolve.One key problem is that many of the earlier tables were developed with spaces in their names (Hindsight is a wonderful thing?). There are over 200 Tables that need changing. I would like to update the Table names replacing every "space" with an underscore"_". AT the same time I would also need to Update all of the QUERIES that use these particular Tables to be updated to reflect these changes made and still work as normal. I can do this manually but it will be very time consuming and perhaps someone has already had to do this when recently upgrading to Access 2013?

View 9 Replies View Related

How To Get The Names Of Table In A .mdb File?

Mar 16, 2007

Hello All,

I ma using a .mdb file in a program and want to get the list of all tables and all the columns of the respective tables in the .mdb file.
In Oracle we use 'select * from table' for getting all the tables in the DB. But how it is done in MS-Access?

Pls help.

Regards,

View 2 Replies View Related

Modules & VBA :: Find All Table Names From External File

Nov 6, 2013

I'm trying to find all the table names inside an external access file from a path.

I have a code for the user to select a file which return a patch to the file.

Then I need to find all the tables names from that file and append them to a list.

so I them can input them into a code and link the tables.

here is the code to get the file patch:

Code:
Function getFileName(path) As String
Dim f As Object
Dim varFile As Variant
Dim path
Set f = Application.FileDialog(3)

[Code] ......

View 8 Replies View Related

Modules & VBA :: Loop Through Table And Create File Names

Oct 22, 2014

I have a VBA routine that runs some queries and then creates a report as a PDF document using my virtual PDF printer. At this point it brings up the Save As dialog and I give the file a name and select a folder to store it in.

But I run this report 30 times for 30 different parameters. The parameters are obtained from a table which contains values such as Cancer, Diabetes, Stroke

-I always name the PDF file according to this value.
-I always choose the same folder.
-I always overwrite the reports I produced last month (copies have been sent elsewhere by then).

how can I get VBA to cycle through this code 30 times, each time selecting the next value from my table and creating/overwriting those files without the need for me to tell it the filename and path?

Code:
Private Sub lstSpecialties_DblClick(Cancel As Integer)

At the moment I am running this code by double-clicking an entry in the Specialty listbox, 'but I would prefer the whole thing to run multiple times for as many Specialties as exist in the table '(currently 30 but could be more in time)

'Warnings off
DoCmd.SetWarnings False
'Make the tables needed for the cumulative queries
DoCmd.OpenQuery "Spec 002 Monthly recruits - part 2 - make table" Each of these queries
DoCmd.OpenQuery "Spec 005 Monthly recruits - part 2 - make table" uses the Specialty selected above
DoCmd.OpenQuery "Spec 022 ABF previous year - part 2 - make table" as a parameter to get
DoCmd.OpenQuery "Spec 025 ABF current year - part 2 - make table" the right data for the report

[code]....

View 5 Replies View Related

Can't Read Recent File Names On File Menu

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

Code To Link Text File As Table

Jan 29, 2008

I'm trying to figure out how to link a text file to my database with VBA. I know how to do this for other types of data sources, using the DoCmd.TransferDatabase acLink command, but need guidance using this with TXT files.

Thanks,


Randy

View 3 Replies View Related

VBA Code For Importing Tab-delimited Text File Into A Table In Ms Access

Aug 25, 2004

Hi

I need to create a command button to import a tab delimited text file into a table in Microsoft Access using VBA Code.

I have set up the button however I am unsure as to how I should approach it and what code i need.
If anybody has any suggestions I would be very grateful.

Kind Regards

Elaine

View 1 Replies View Related

Modules & VBA :: Access 2007 / Code For Bulk Importing TXT File Into Separate Records Same Table?

Jul 9, 2014

I have 12,000 cvs that i need to get into An access database so i can start to extract email info etc. They are stored in one folder All Cvs under each of their names edc.txt (i have converted them to .txt) i want to create one table with two fields name (taken from the cv filename and contents (taken fromthe contents of the .txt file). I am using Access 2007.

View 2 Replies View Related

Forms :: How To Change 2 Field Names With VBA Code Within A Form

Nov 28, 2013

I have two text fields:

their names are :

field 1 ="txtfilter"
and
field 2: "text333"

How can i change the names of the two fields with vba code?

I need field 1 to get the name of field 2
and field 2 to get the name of field 1

This will be temporarily.

using access 2013

View 5 Replies View Related

File Names

Feb 29, 2008

Hi,

I apologise in advance for my lack of understanding but I need to know whether an access 95 database will accept file name's that are 21 characters long and contain underscore's?

I have never had to get involved ith access database's so far but have been told find this out.
Any help would be much appreciated.

Thanks in advance,

Mike

View 3 Replies View Related

Reading File Names

Dec 9, 2004

Is there a way for a access to read the filenames of files contained in a folder on the local machine and paste
those filenames in a database field?

View 1 Replies View Related

Lock File Get Login Names

Dec 19, 2006

In the lock file I noticed I can see the computer names of the people who have the db open. Is there a way to get the login names from this file so I can knock some sense in my co-workers who still have the database on

View 1 Replies View Related

Hi And A Hope Of Help Over Listing File Names In Access

Nov 14, 2006

Hi, newbie here to this forum, been looking about for ages to try and find an access based forum.

I am not a great coder, have not really done it, nor remotely understand it, but I have still managed to write a database in access for the office.

We run a residential care home, where we had 5 databases (MS Works) which held different information of the residents within the home but duplicated name, dob, etc. I have successfully writen a access database which works well. But now I want to start pushing it a degree further if I can.

We took delivery of a HP officejet all in one printer, and it has a scanner with document feeder which we scan letters in so we can share them with head office, but what I would really like to do, is scan letters in relating to a specific client, and be able to save the file name as a link, so an other user on an other PC can open the document on their PC. Basically, I want to avoid us going to the filing cabinet to refer to a letter which was written to us.

I am using XP Home, with Office 2003 Pro, and Acrobat 8 Pro.

Any ideas where to even start looking?? I did do a search, but have no idea how to start.

Thanks in advance.

View 3 Replies View Related

Populating Picture File Names From A Folder

Jan 13, 2006

I could realllllllly use some help here....

I have database that looks like this:

Type | Pic1 | Pic 2
-------------------------------------------
12-5525 C:RC125525-01 C:RC125525-02
12-3556 C:RC123556-01 C:RC123556-02

As you can see the picture naming system is standard and is based on the content in the type field. If one record of the Type field is say 12-6636 then the picture will be RC126636-01 (for Pic1) and RC126636-02.

Is there a way where the user say... can type C: and it will populate the picture file names in a combo box?

There are about 2000 records in the DB and I am just trying to find a way to keep a user from typing all that stuff.

:rolleyes: Could there be a way to do all 2000 records at once?...:rolleyes:
Thanks.

View 3 Replies View Related

Forms :: Get File Names Of Excel Spreadsheets From A Folder

May 23, 2014

I have a form with a subform.In the footer of the subform I have a combobox that get the file names of excel spreadsheets from a folder.I have a button (no code on it yet) that I want to press and import that spreadsheet into the table for the subform and associate it with the main form.

View 11 Replies View Related

Modules & VBA :: Export Pdf With Field Names Included With File Name

Feb 7, 2014

I have a report that I would like to export to a folder, and I would like to include the FullName within the naming convention of the PDF. When I run the report it prompts for the Employee ID..Here is what I have so far, I'm getting an error of "Run Time Error 424 object required" on the String Report Name,

Private Sub Create_PDF_Click()
Dim myPath As String
Dim strReportName As String
DoCmd.OpenReport "Report_Salary_Worksheet _Finalized_By_EmpID", acViewPreview
myPath = "W:COMPENSPHYSICIANSComp Plans"
strReportName = Report_Salary_Worksheet_Finalized_By_EmpID.[FullName] + ".pdf"
DoCmd.OutputTo acOutputReport, "", acFormatPDF, myPath + strReportName, True
DoCmd.Close acReport, " Report_Salary_Worksheet _Finalized_By_EmpID "
End Sub

View 5 Replies View Related

Modules & VBA :: Searching Subfolders To Open Files Using File Names

May 19, 2015

I am using Access 2010 with Win-7.Shared, split database with several users.Database Purpose:PM Procedure for Medical Equipment..To be able for the user to copy the file name of 1 or more technical manuals and paste into a table used for a subform on the procedure parent form.Users can then open the related files stored in a common directory that are related to the procedure when later reviewing the procedure .

Problem:File path on the common drive for our group remains static Syspro_5VOL1BIOMEDCOMMONEquipment (Service Manual).The subfolders are not static.There is an unlimited number of sub folders by vendor, model, or make.The subfolders sometimes get renamed as vendors change ownership.The file itself usually does not get renamed.New subfolders get added as needed.Everyone in our group has access to this area of the server.

Question:Is there a way in VBA that when a user opens the procedure record form and dbl-clicks the name of the file in the subform, Access can start at the parent folder and keep searching through all the subfolders until it finds the file?I cannot depend on people in my group to be able to correctly update hyperlinks so I need a way people with no Access knowledge can even use even if its a little slow.

View 4 Replies View Related

Command Button To View PDF / Excel File Or JPEG From Object Within Database Table

Aug 12, 2013

I have created a database for a church cemetery. It contains the usual names, birthrates deaths, etc.... I have also created a map of the cemetery in PDF format with the lot number highlighted which is assigned to a particular record. I did the same in excel with a layout of the lot and a JPEG picture of the grave marker. In my table I created Three columns - Site Plan, Lot Plan, and Grave marker. I insert the specific site plan, lot plan, and jpeg picture using the "insert object" in the table. On my form after a search, I have created three buttons.. Site Plan, Lot Plan & Grave Marker.

I have looked and experimented trying to assign these command buttons to open these files on the form. I don't have any experience with macros or VB code.

View 4 Replies View Related

Problem With SQL Looking At Field Names In Database.

Jan 4, 2006

Hi All

I am having a problem running a piece of SQL code for a multiselect box that needs to run a query to generate a report, i think i know what the problem is but cannot get passed it and i really need to. I cannot change the field name because it is linked to another db that is for other business use. Here is the code :

Private Sub response_Click()

Dim db As DAO.Database
Dim qdf As DAO.QueryDef
Dim varItem As Variant
Dim strCriteria As String
Dim strSQL As String
Set db = CurrentDb()
Set qdf = db.QueryDefs("responsecodes")
If Me!response.ItemsSelected.Count > 0 Then
For Each varItem In Me!response.ItemsSelected
strCriteria = strCriteria & "MAXIMO_V_WORKORDERS_FA.WORKORDER-RESPONSIBILITY = " & Chr(34) _
& Me!response.ItemData(varItem) & Chr(34) & "OR "
Next varItem
strCriteria = Left(strCriteria, Len(strCriteria) - 3)

End If
strSQL = "SELECT * FROM MAXIMO_V_WORKORDERS_FA " & _
"WHERE " & strCriteria & ";"
qdf.SQL = strSQL
End Sub

The problem is in the

strCriteria = strCriteria & "MAXIMO_V_WORKORDERS_FA.WORKORDER-RESPONSIBILITY = " & Chr(34) _
& Me!response.ItemData(varItem) & Chr(34) & "OR "

The dash between WORKORDER and RESPONSIBILITY is the problem but that is the field name, when i run the query to hold the data of the multiselect box it hold the data but put's the following statement into the query field name, so i cannot access this in my report query.

[MAXIMO_V_WORKORDERS_FA].[WORKORDER]-[RESPONSIBILITY]

What i need is for the [MAXIMO_V_WORKORDERS_FA] to be the table name and [WORKORDER]-[RESPONSIBILITY] to be [WORKORDER-RESPONSIBILITY] to be the field name then i know it will work.

Any help would be greatly appreciated.

Paul

View 13 Replies View Related

Changing Database Names In External Queries

Nov 19, 2004

I have a database that I used as a back-end for an Excel spreadsheet. Now that the database has been moved from one place on the network to another, I need to update the information in my spreadsheet to reflect the database's new name and location. Is there any way of doing this short of deleting and recreating the queries in Excel?

View 2 Replies View Related

Forms :: Add People's Names Into Database Using Two Fields?

Jul 24, 2014

How important is it to add people's names into a database using two fields ?..ie: [FirstName] and [LastName]. Would it be ok to put their full name into one field if you also had a unique Identity Number for each person in the same table ?

View 14 Replies View Related

Expression To Create A File Code

Nov 16, 2004

I have a main filing table and three look up tables (file cabinet, topic, and subtopic). In the three look up tables I have created short codes to identify the name of the field.

I want to create a main filing code that takes the codes from each lookup table and combines it into one field. If the location of the file changed I would need the code to change.

Example file cabinet location Rod 1 is R1, Accounting is AP; file topic Active Jobs is ACTJOB, Bank Transactions is BANKTR; subtopic Northeast Fire Station is NETCFS. For the file for the fire station the code would read R1ACTJOBNETCFS.

The form is set up as a cascading combo.

The only purpose for this field is to allow me to do a mail merge to create labels so that I can re-file folders easier without having to go into the database and look up the locations.

I don't know if I should create the expression in the form or if I should do something in the table field.

Suggestions?

View 1 Replies View Related

Execute A Batch File From VBA Code?

Jan 26, 2012

I am using MS Access 2007 and I am trying, from my VBA code, to execute (or run) a Batch file. Now the batch foile works, but not from my code.

I used to be able to just do this --> Call Shell("S:AccountingAPTex FilesFile List Generator.cmd ", 1) And it would runit. But using this I get a message telling me that it is an invalid procedure call. So upon looking around on the net I found tha ton place said that with MS Access 2007 you need to do this:

Call Shell(Environ$("COMSPEC") & " /c S:AccountingAP1099 ITEMSW9 FolderCorrected 2011 W9File List Generator.cmd ", vbNormalFocus)

But while it does not error out it dooes noting eitheer. What the batch file does, when it works, is produces a list of all the file names in a folder.

View 4 Replies View Related

Populate A List Box With Table Names & Table Data

Feb 27, 2008

I have 2 questions/problems:

1. I want to populate a list box with all the Tables Names in my Database using VBA.

2. I also want to create another List Box or Grid (or any thing that will show table data) that when i have select a Table Name (See above (1)) it will show all the data in that table in the List Box. Was thinking some kind of SQL using vba to populate the list box?

Any ideas or help will be much appreciated

Richard

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved