Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can you export results generated in a Form

Status
Not open for further replies.

ibv

Programmer
Jul 31, 2008
4
US
Is it possible to export (or retrieve) calculated results from a Form?

I have a computer programming background but I am a beginner with programming in Access and I have some complex calculations that work great in a Form but when I try to program them in a Query, I get the "The Query is too complex" message. I would love to just be able to retrieve/export the data from the already programmed Form so that the information can be merged into a Report or Word Document.

Is this even possible?
 
It is possible to write data from a form to a word document using automation. Bookmarks are helpful.
 
To give yourself some flexibility, I would recommend making user defined functions to do your calculations. I assume from what you are saying is that you have written the functions right in the controls.

The same function can be used in a query or as the control source. So for example here is a function that PHV wrote to find the max value of multiple fields
Code:
Public Function myMax(ParamArray Args())
Dim i As Long, rv
For i = 0 To UBound(Args)
  If IsNull(rv) Or rv < Args(i) Then rv = Args(i)
Next
myMax = rv
End Function

If you wrote this as a function within a calculated control you probably would have a very complex set of nested iifs.

But using this in a control would look something like:
=myMax([txtBxOne],[txtBxTwo],[txtBxThree])
in a query

Select myMax(fldOne,fldTwo,fldThree) as MaxValue from tblTable
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top