473,407 Members | 2,359 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,407 software developers and data experts.

Access 2003, extracting form contents while exporting to xml

Hi, I have a query that is being exported to XML. Everything works, except for expressions in the query such as:

Expand|Select|Wrap|Line Numbers
  1. [Forms]![find projects]![Find Projects Subform].[Form]![Budget]
When the query is just opened normally, the expression works but when the query is being exported to xml I am asked to specify the value for that expression even though the form is filled in with a value already. What do I need to change for this to work? Thanks! :)

Using Access 2003 Professional Edition on Windows XP Pro
Jun 19 '08 #1
1 1140
Stewart Ross
2,545 Expert Mod 2GB
Hi. Assuming your form is open (see the PS below), I suspect that this is a Jet Database Engine problem, as there is a known bug with the use of direct form field references as part of a Where clause. Such references often work in other circumstances yet fail unexpectedly when used in a different way. To take an example, a Select query with a subform reference such as your one will fail if the Select query is converted to a crosstab. Jet fails to recognise the subform control reference as a valid field name, yet in the Select form it correctly recognises the subform reference.

To avoid this problem I use a function placed in a public code module which can return a control value given the name of the form and the field reference. In the query I then refer to the function, not the form field directly. I have had no failures with this approach.

The function I normally use is intended for main form controls, but is easily modified to cope with subforms:

Expand|Select|Wrap|Line Numbers
  1. Public Function SubFormFieldValue(FormName As String, SubformName As String, FieldName As String)
  2.     SubFormFieldValue = Forms(FormName).Controls(SubformName).Form.Controls(FieldName)
  3. End Function
(Please note that as an artifact of this post there are spaces shown between the l and the s in the Controls(FieldName) part - please remove them when pasting)

Copy this to a public code module (in the the Modules section of your database), or if you do not have any create a new module, paste the function in and store the module under any suitable name.

In your query replace the direct form field references with

Expand|Select|Wrap|Line Numbers
  1. SubformFieldValue("find projects", "Find Projects Subform", "Budget")
This should resolve the problem with the lack of recognition of the subform field reference in your XML exports.

-Stewart

PS - I just thought - the form is open at the time you run the XML export, isn't it? If it isn't, the query will not be able to fetch the value of the controls concerned, and will ask you for the values - and my function will fail as the form is not open.
Jun 20 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Frederick Noronha \(FN\) | last post by:
---------- Forwarded message ---------- Solutions to Everyday User Interface and Programming Problems O'Reilly Releases "Access Cookbook, Second Edition" Sebastopol, CA--Neither reference book...
4
by: Otis Hunter | last post by:
I have been given an Access Database which contains a table that has an OLE object field that contains a Word document. That table contains hundreds of records. I would like to find out how I can...
0
by: Otis Hunter | last post by:
I have been fighting with this for days and your expert help is needed! Below is the code I am executing which results with "Object doesn't support this property or method". The error is occuring...
5
by: Jack MacDonald | last post by:
This is very strange and disturbing. Last night I opened the FE of my development version of an A97 database and immediately received a Windows-level error message titled "msaccess.exe Application...
8
by: Jerry | last post by:
I have an off-the-shelf app that uses an Access database as its backend. One of the tables contains a field with an "OLE Object" datatype. I'm writing some reports against this database, and I...
52
by: Neil | last post by:
We are running an Access 2000 MDB with a SQL 7 back end. Our network guy is upgrading to Windows Server 2003 and wants to upgrade Office and SQL Server at the same time. We're moving to SQL Server...
9
by: Fish Womper | last post by:
I am at best a part time developer of Access databases. I use Access 2.0, as this is all my employer has on its computers. Even so, to use this ancient version requires a fairly convoluted...
49
by: Mell via AccessMonster.com | last post by:
I created databases on Access 2003 and I want to deploy them to users. My code was also done using 2003. If they have Ms Access 2000 or higher, will they be able to use these dbs with all code,...
8
by: Irene | last post by:
Hi, I have an MS Access Database with 1 Table containing about 2 million records in Unicode (diferent languages). I would like to export the Table to a Text file (CSV, Tab, etc.) Access...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.