B
bbrazeau via AccessMonster.com
I don't know if this is the proper subgroup to be discussing this in but here
goes: I have a database "TEST1" in it I have a query "MyTableQuery" in this
query there is a calculated field "TotalCost" which has its return value set
to a public module level function "performcalc1" the call looks like this:
TotalCost: performcalc1() . I am trying to get the recordset for this record
in the query so I can get the field values "Value1" in this simplified
function and perform the calculation. The code I have written so far is shown
below. I've read in the help files that in order to get a database, or
recordset object I need to include the data access object in the references
for the database. I looked for it and could only find "Microsoft DAO 3.6
object library so that is what I have included. When I open the query I get
an error "could not find file 'TEST1.mdb' . Is this because its already open?
I'm also not sure the line: fldOne=rstMyTableQuery.Fields!Value1 is correct.
What I want is the value thats held in the Value1 field of my query.Could any
one help Please?
Public Function performcalc1() As Currency
Dim dbsTest1 As Database
Dim rstMyTableQuery As Recordset
Dim fldOne As Integer
Set dbsTest1 = OpenDatabase("TEST1.mdb")
Set rstMyTableQuery = dbsTest1.OpenRecordset("MyTableQuery",
dbOpenDynaset)
fldOne = rstMyTableQuery.Fields!Value1
performcalc1 = fldOne * 100
rstMyTableQuery.Close
dbsTest1.Close
End Function
goes: I have a database "TEST1" in it I have a query "MyTableQuery" in this
query there is a calculated field "TotalCost" which has its return value set
to a public module level function "performcalc1" the call looks like this:
TotalCost: performcalc1() . I am trying to get the recordset for this record
in the query so I can get the field values "Value1" in this simplified
function and perform the calculation. The code I have written so far is shown
below. I've read in the help files that in order to get a database, or
recordset object I need to include the data access object in the references
for the database. I looked for it and could only find "Microsoft DAO 3.6
object library so that is what I have included. When I open the query I get
an error "could not find file 'TEST1.mdb' . Is this because its already open?
I'm also not sure the line: fldOne=rstMyTableQuery.Fields!Value1 is correct.
What I want is the value thats held in the Value1 field of my query.Could any
one help Please?
Public Function performcalc1() As Currency
Dim dbsTest1 As Database
Dim rstMyTableQuery As Recordset
Dim fldOne As Integer
Set dbsTest1 = OpenDatabase("TEST1.mdb")
Set rstMyTableQuery = dbsTest1.OpenRecordset("MyTableQuery",
dbOpenDynaset)
fldOne = rstMyTableQuery.Fields!Value1
performcalc1 = fldOne * 100
rstMyTableQuery.Close
dbsTest1.Close
End Function