How to call Excel Functions

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Microsofts article 198571, Example 2 shows how to call the Excel Chi-Squared function. I attached this code to a command button, works great. I have tables in a one-to-many relationship and want to reference the field vs hard coding numbers. Any thoughts? Thanks in advance

Example 2 code adjusted for Access 200

Sub xlMedian(
Dim objExcel As Excel. Application
Set objExcel = CreateObject("Excel.Application"
MstBox objExcel.Application.WorksheetFunction.ChiInv(0.05, 10
objExcel.Qui
Set objExcel = Nothin
End Sub
 
You are really asking: "How do I reference the values of fields from tables
with a one-to-many relationship?", no?

This will get the value of one field from one record chosen at random from
one table, into a local variable:

dim sField as Integer ' or String, Date, whatever.
sField = DLookup ("name of field", "name of table")

HTH,
TC


Forrest said:
Microsofts article 198571, Example 2 shows how to call the Excel
Chi-Squared function. I attached this code to a command button, works great.
I have tables in a one-to-many relationship and want to reference the field
vs hard coding numbers. Any thoughts? Thanks in advance.
 
Yes and no, TC. The Excel function works on two or more data points, example #2 hard codes 0.05, and .10
I need to capture all values within the specified field and run the function against a list of values in the same field. The record count could contain up to a couple hundred records. Is that doable? Currently I accomplish this task in Excel where the function references a range
Thanks for your response and I hope I clarrified what I am trying to accomplish

----- TC wrote: ----

You are really asking: "How do I reference the values of fields from table
with a one-to-many relationship?", no

This will get the value of one field from one record chosen at random fro
one table, into a local variable

dim sField as Integer ' or String, Date, whatever
sField = DLookup ("name of field", "name of table"

HTH
T


Forrest said:
Microsofts article 198571, Example 2 shows how to call the Exce
Chi-Squared function. I attached this code to a command button, works great
I have tables in a one-to-many relationship and want to reference the fiel
vs hard coding numbers. Any thoughts? Thanks in advance
 
Back
Top