An Easy Way To Create An XML File From A Query?

Jun 13, 2007

Is there a relatively easy way to output the results of a query to an XML file?

I have the file writer set up more or less:
Code: Dim intFn As Integer Dim strFilePath As String Dim strOutBuf As String strFilePath = "c: emp est.xml" intFn = FreeFile Open strFilePath For Binary Access Write As #intFn strOutBuf = "<?xml version=" & Chr(34) & "1.0" & Chr(34) & " standalone=" _ & Chr(34) & "yes" & Chr(34) & "?>" & vbCrLf strOutBuf = strOutBuf & "<file>" & vbCrLf 'DO FOR EACH LOOP HERE strOutBuf = strOutBuf & "</file>" Put #intFn, , strOutBuf Close #intFn
If this were a C or JAVA application, I would just write a "for each" statement similar to as follows:

Code:For Each (Row in Query){ strOutBuf = strOutBuf & "<entry>" & vbCrLf For Each (Field in Row){ strOutBuf = strOutBuf & "<" & (Column Name) & ">" & (Value) _ & "</" & (Column Name) + ">" & vbCrLf } strOutBuf = strOutBuf & "</entry>" & vbCrLf}
What commands would I use in Access to get each separate row in a query? And then to get each field in that row? And how about the column names for the XML tags?

Thank you for your help.

View Replies


ADVERTISEMENT

Queries :: Create A Query That Will Pull All Of Data Out Of Text File

Nov 13, 2013

I have a text file linked to this database, and I'm trying to create a Query that will pull all of the data out of this text file, and add a rank if two of the values match in multipe records.So in other words, when multiple records have the same [JOBNBR] , I want to evaluate the [TIMESTAMP] value to see if it is the smallest one, and so on.I don't want to create multiple queries to do this, is there any way to do this? Here's what I have:

Code:
DDR: (Select count(*) from tblMyDataImport Where [tblMyDataImport].[TIMESTAMP] < [TIMESTAMP] AND [tblMyDataImport].[JOBNBR]=[JOBNBR] )

View 5 Replies View Related

Queries :: Create Query To Find Certain Records Based On Data In CSV File

Aug 14, 2014

This may not even be possible, but I am looking to create a Query that can locate records in an Access Table based on 2 columns of data that I have stored in a CSV file.

My table contains several fields, 2 of which are "Dept" and "SKU" and has over a million records.

My CSV file contains 3 fields: "Dept", "SKU" and "Total" - total being the number of times that particular Dept/SKU combination is used.

I need to be able to parse the dept/sku values from each row in the CSV to the query and locate only the records that contain the same values in the Access table.

The plan being to delete out those that are identified by the query.

View 6 Replies View Related

Need Help With A (probably) Easy Query

Oct 16, 2007

Hello

I'm a beginner when it comes to Access. Right now I'm trying to create a movie database and need help.

I want to be able to search for a title that contains a specific word. For example, I have a movie called "the cube", right now i can only find the movie by typing the full or a part of the correct sequence of the title. For example I can find the movie when typing "the" or "the cube" but not when typing only "cube". This is my problem.

Right now my query looks like this:

SELECT Movies.Title
FROM Movies
WHERE Movies.Title Like Forms!frm_search_title!search & "*";


Please help.

View 2 Replies View Related

New To Access Help With Easy Query

Aug 10, 2005

I have used Excel for many years and used the if formula. I have just started using access and need a little help. I have a table the has 20 fields. I am only concerned with about 8 of these fields for a report. I have a field named completed in this field I put a "x" if the job is complete. I would like to create a report that shows me all active jobs. Everything that does not have an "x" in complete field. Can somebody either direct my to the forums I should be in or possible give me the correct coding. Thanks for your help in advance.

View 8 Replies View Related

Easy Date Query

Aug 29, 2006

G'day all,
I'm a novice to Access. I'm trying to setup an adhoc query, whereby a user can select all the records for a particular month.
I've tried using ([month]) in the criteria row but I get an error message??? :confused: :confused:

View 4 Replies View Related

ACCESS - Easy QUERY (Help)

Dec 28, 2006

HI,

I have the next 3 tables,

*************************************************
Table USER: id_user (primary key)
name

Rec: id_user, name
------------------
rec: 1, A
rec: 2, B
rec: 3, C

*************************************************
Table AP : id_ap (primary key)
nr_ap (primary key)
id_user
id_sort

Rec: id_ap, nr_ap, id_user, id_sort
-------------------------------------
rec: 1, 2, 1, 1
rec: 2, 5, 2, 1
rec: 3, 1, 3, 1
rec: 4, 3, 1, 2
rec: 5, 4, 2, 2
rec: 6, 3, 3, 2

NOTE:
SELECT sum(nr_ap) AS Total FROM AP

with id_sort = 1 -> SUM(nr_ap) = 2+5+1 = 8
with id_sort = 2 -> SUM(nr_ap) = 3+4+3 = 10
*************************************************
Table SORT: id_sort (primary key)
value

Rec: id_sort, value
------------------
rec: 1, 80
rec: 2, 200

**********************************************
I need do create a QUERY that for all records in SORT table, it will
show only for user 'A', the rescords as in the result shown below.

NOTE: xxxx = (valueSUM(nr_ap))*nr_ap

RESULT EXPECTED
------------------
id_sort, name, ap, value, xxxx

1 A 2 80 20 (808)*2 = 20
2 A 3 200 60 (20010)*3 = 60


Regards,
Elio

View 3 Replies View Related

An Easy Query Question(Hopefully)

Feb 21, 2008

I've posted this on another forum, but I'm not getting any help on it. Let me know if I need to explain it in more detail.

I have one table containing a list of addresses:

Address
1301 Main St.

I have another table containing names :

Name 1
John

I have yet another table containing names:

Name 2
Chris

The primary key for the address table matches up with the primary keys in the name tables. I need to write a query that will pair the addresses in the address table with the names from each of the name tables. It should look like this:

Address..................Name
1301 Main St. .........John
1301 Main St. .........Chris

Can anyone help? Thanks.

View 2 Replies View Related

Query Problem Easy

Apr 20, 2005

I have a table with 8000 records. Now i have two fields (last name) and(ID). Now i want to see all the people that have different ids and that only???

ex

smith 10001
smith 10002
smith 10003
extc

example please

View 1 Replies View Related

Cannot Create An MDE File

Jul 4, 2005

I use office 2003, first I had to convert my database, then I did the database splitting then, remove all menus from running at startup, I tried to create an mde file but it didn’t work.

This is what I got:

This error is usually associated with compiling a large database into an MDE file. Due to the method used to compile the database, a considerable number of TableID references are created for each table. The Microsoft Jet database engine version 4.0 can only create a maximum of 2048 open TableIDs at one time. Exporting a database as an MDE potentially can exceed this limit if the database has a large number of objects (table, macro, form, report, etc).

There is no accurate method to estimate the number of TableIDs the Jet database engine uses during the process of compiling a database as an MDE. However, each VBA module and each form uses one TableID, as a result, if the database has 500 forms, and each form's HasModule property is set to Yes, as many as 1,000 TableIDs are used.

So installed office XP and tried the same steps but still not working.

View 1 Replies View Related

Need Help Creating A Simple Query. Easy For Any Of You. Pls Help

Jun 14, 2004

Hi,
I don't know how to create a simple query that will compare 2 tables and create a new one after that.
Each table has only one field.

Example:

Table 1 has records A, B, C, D and E
Table 2 has records A and C

I want new table to be like table 1 minus table 2. Like cleaning up table 1.
New table would have records B, D and E

I think it's very simple but I can figure how to do it.

Could you pls give me advice?

Thanks a lot,

skuba

View 3 Replies View Related

Unable To Create An Mde File

Jan 1, 2006

I am running access 2000 9.0.2720. I wanted to create an MDE file but every time I attempt I get the message 'unable to create an MDE file'. Any advice?

View 1 Replies View Related

Create Custom Help File

Oct 11, 2004

I am just having a heck of a time, in trying to make a custom help file.

Has anyone had any luck? I sure would like to see a sample database, showing a
custom help file. I just about tried everything, but not to smart about setting one up.
I have tried the wizzard as well. I know where I get hung up is, trying to map the help file,
to the Help ID number.

Any help would be appreceiated

View 6 Replies View Related

Unable To Create .mde File

Oct 28, 2004

I was able to create a MDE database from .MDB file (1900 KB) using Access2000 but not on the other database (5000 KB)
I followed the steps (under tool -database utilities- make MDE file), the message box shown " Microsoft Access was unable to create a MDE database"

Is there any limit on the size of the file? What should i do or check?

NaNy

View 4 Replies View Related

Can't Create MDE File - Alternative

Dec 7, 2005

I have tried to create an MDE file for my database but can't figure out why it will not let me. I can't don't think I am over the limit in open TableIDs. I have 76 Forms and 91 Tables.

I am setup with two databases - the database with the data is on the server. Is there any other alternative that I can do other than putting the mdb file directly on the client. And if not is there a way to stop the mdb file from constantly growing in size.

View 4 Replies View Related

How To Create Log File In Access

Jun 11, 2012

How I can create a log file in Access?

This file will record all processing on access file

View 6 Replies View Related

How To Create An Empty Excel File ?

Sep 28, 2005

Hello,
I would like to know how to create an empty Excel file (from Access) ?
I would like to name the workbook (xxx.xls) name the sheets and give the folder where to store it.
Thanks in advance for help.
VINCENT

View 5 Replies View Related

Create Help File Inside Of Access

Oct 6, 2005

I created a help file in access that lets you have text mesasge up to 1024 chars. Just press F1 key on any control that you have setup to bring up help message.

Does any one see any problems with the way I did this?




Form
Help File: = ""
Help Context ID: = 0

For each control on the form where you would like to have a help message do the following.
Form
Control
Help Context ID: = Set to one of the help index numbers in the help table.

Add KeyDown Event to the control

Private Sub Text0_KeyDown(KeyCode As Integer, Shift As Integer)
'Add this line
KeyCode = DisplayHelp(KeyCode, Me.ActiveControl.HelpContextId)
End Sub



module

Function DisplayHelp(KeyCode As Integer, HelpContextId As Integer) As Integer
Dim dbs As DAO.Database
Dim rstRecords As DAO.Recordset

If KeyCode = VBKeyF1 Then ' 112 = F1
Set dbs = CurrentDb
Set rstRecords = dbs.OpenRecordset("SELECT tlbHelp.Index, tlbHelp.HelpMessage " & _
"FROM tlbHelp WHERE (((tlbHelp.Index)=" & HelpContextId & "));")

With rstRecords
If .RecordCount > 0 Then
Call MsgBox(!HelpMessage, vbInformation, "Help")
End If
End With
DisplayHelp = 0 ' Clear KeyCode
rstRecords.Close
Set dbs = Nothing
Else
DisplayHelp = KeyCode
End If
End Function



Create Table and Fields

Table Name: tlbHelp
Field Name: Index as Number
Field Name: HelpMessage as Memo
Field Name: FieldName as Text
Field Name: FormName as Text

How type in custom number and message for each help message.

View 2 Replies View Related

Create Connection Without Lock File

Feb 26, 2006

Hi there, we currently have a database that users write to through an excel form. Each time a user sumbits a record to the database we open a connection up with the below code, insert the record and then close it. This creates a ldb file for 1-3 seconds depending on how long it takes.

' OPEN DATABASE CONNECTION
Set dbConn = New ADODB.Connection
dbConn.CursorLocation = adUseClient
dbConn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0"
dbConn.Open sConn

' INSERT RECORD THROUGH EXECUTE COMMAND
dbConn.Execute("INSERT INTO.... VALUES....")

' CLOSE CONNECTION
dbConn.Close

Is it possible to open the connection up without an ldb file being created so more than 1 user can insert a record into the database at the same time?

Thanks for your time,

Cheers

Tony

View 6 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

Modules & VBA :: How To Create Hexadecimal File

Sep 13, 2013

I would like to read a TIFfle to ACCESS, and store its content as hexadecimal like below to further other process..., how can I achieve this change and storage??

0000: 49 49 2A 00 4E 00 00 00 80 3F E0 50 38 24 16 0D
0010: 07 84 42 61 50 B8 64 36 1D 0F 88 44 62 51 38 A4
0020: 56 2D 17 8C 46 63 51 B8 E4 76 3D 1F 90 48 64 52
0030: 39 24 96 4D 18 80 80 00 60 00 00 00 01 00 00 00
0040: 60 00 00 00 01 00 00 00 08 00 08 00 08 00 0F 00
0050: FE 00 04 00 01 00 00 00 00 00 00 00 00 01 03 00
0060: 01 00 00 00 11 00 00 00 01 01 03 00 01 00 00 00
0070: 0F 00 00 00 02 01 03 00 03 00 00 00 48 00 00 00
0080: 03 01 03 00 01 00 00 00 05 00 00 00 06 01 03 00

View 4 Replies View Related

Create Database From INI File Provided

Mar 3, 2012

An ancient application I'm working with came with .ini file which looks like an instruction set to create an access database. A sample few lines look like:

TABLE, USER, 13
FIELD,USRID,LONG,2,NODUP,ID,False,0,AUTO
FIELD,USRFNAME,TEXT, 50, NO, , True, 1

TABLE,VISITS,15
FIELD,VISIT,TEXT,12,NODUP, ID,False, 0

and so on.

Is there a way to get Access (2007 in my case) to create a new db by reading from this file? Or do I need to manually enter all this information.

View 1 Replies View Related

Create Linked Read-Only File

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

Modules & VBA :: Create New Backend File From Existing One

Nov 4, 2013

I'm trying to create a button that will open a save window so that user can select where and the name of a new backend file.

and create a new backend file from the one in use and link to the new open.

View 4 Replies View Related

(Hopefully!) A Very Easy Question To Answer - Running A Query From A Command Button

Dec 27, 2005

Hi all

I'm currently working through developing my first database.

Basically, what I would like is for a query to run from a command button.

The query should look at a field in a table (a yes/no field) and report back the ones that have been filled in.

I know how to run the query from the access 'Query' window, BUT, I would like this query to run from a click of a command button on a form.

I've looked it up in a book, which explains about SQL, and didn't really understand it. I've also searched on here, but people talk about Macro's, and I don't know anything about them.

Can anyone help?

Cheers

View 2 Replies View Related

Embedded Pics Create Huge File Size

Jun 27, 2006

I'd read a few places that embedding pics wasnt the greatest of ideas, but I thought that 1 JPG embedded onto 2 forms would be ok and would prevent the pic from being deleted or moved. (Theyre always screwing with the server here.) But it's making my DB huge.

No pics embedded
Size: 808kB

1 Pic Embedded into 2 forms
Pic Size: 156k JPG
DB Size: 135 MB

Is this normal? I could understand a 156k pic adding somewhere around 156k to my DB, but 134 megs? Anyone have any insight?

View 4 Replies View Related







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