Problem with vba code to export query result in excel

J

Jack

Hi,
I have a access report that exports to excel with click of a button after
choosing parameters. This works well. However I have to modify couple of
fields to utilize formula in the export module. I am not sure how to do this.
I am writing the above code which seems to cause problem. I appreciate any
help to resolve this issue. Thanks.

Code:
If lngColumn = 12 Then
xlc.Offset(0, lngColumn).Value = =([UnitPrice]*[OriginalShippedQty])/1000
End If

It seems the fields UnitPrice and OrigianalShippedQty are not being
recognized here
 
P

PieterLinden via AccessMonster.com

Jack said:
Hi,
I have a access report that exports to excel with click of a button after
choosing parameters. This works well. However I have to modify couple of
fields to utilize formula in the export module. I am not sure how to do this.
I am writing the above code which seems to cause problem. I appreciate any
help to resolve this issue. Thanks.

Code:
If lngColumn = 12 Then
xlc.Offset(0, lngColumn).Value = =([UnitPrice]*[OriginalShippedQty])/1000
End If

It seems the fields UnitPrice and OrigianalShippedQty are not being
recognized here

One thing that looks odd is the doubled equals sign... VBA doesn't have two
separate operators for "set equal to" and "is equal to"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top