Reports: Accessing Fields

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

Guest

I need a way to access a specific number field in a table I'm currently using
in a report using VB Code. I tried to resize and hide a txtBla within the
Detail section of the report and then using (Me.bla bal bal) to bring the
information into the VB Code but it didn't work to my satisfication. I know
this is kind of a hack approach to programming but time if a factor I need to
know how to perform this task properly.

Thanks for any help you can give me
JJA
 
Hi

Sounds like you need to use dlookup. No need to add a dummy field to the
report. Look for dlookup in help and try something like...

ValueWanted = dlookup("FieldName", "TableName", "criteria")

The "criteria" is optional and used to select a specific record.
If your table only has 1 row then you won't need the criteria.

hth

Andy Hull
 
I'm still having a bit of a problem accessing fields from within a report
detail VB code. Below is the code I place within the detail section of my
program.

Set field Test_Scores to variable intTestScore
varTestScore = DLookup("[Test_Score]", "TestScores030806", "[Test_Score > 0]")

I'm sure it's something basic that I'm missing.... please help

***Andy thanks for your input that has me this far
 
Hi again

The criteria part of your lookup has the closing square bracket in the wrong
place. When used, square brackets should go around field names not the whole
expression.

Change the criteria part to...

"[Test_Score] > 0")

so the whole expression reads...

varTestScore = DLookup("[Test_Score]", "TestScores030806", "[Test_Score] > 0")


Regards

Andy Hull


JJA said:
I'm still having a bit of a problem accessing fields from within a report
detail VB code. Below is the code I place within the detail section of my
program.

Set field Test_Scores to variable intTestScore
varTestScore = DLookup("[Test_Score]", "TestScores030806", "[Test_Score > 0]")

I'm sure it's something basic that I'm missing.... please help

***Andy thanks for your input that has me this far


JJA said:
I need a way to access a specific number field in a table I'm currently using
in a report using VB Code. I tried to resize and hide a txtBla within the
Detail section of the report and then using (Me.bla bal bal) to bring the
information into the VB Code but it didn't work to my satisfication. I know
this is kind of a hack approach to programming but time if a factor I need to
know how to perform this task properly.

Thanks for any help you can give me
JJA
 
Back
Top