Acces and Excel Help

hewstone999

Registered User.
Local time
, 17:35
Joined
Feb 27, 2008
Messages
37
I’m currently using vba in access to export values to an Excel Spreadsheet. I have this query below but I cant seem to export the value the SQL statement gives to the correct field in the spreadsheet.

n = 2
temp01 = xlSheet.Range("F" & n).Value
temp02 = xlSheet.Range("B" & n).Value

sql1 = "Select IFF_name from IFF_Descriptions Where IFF_Description = “ & temp02

temp01 = sql1
 
try:
Code:
n = 2
temp01 = xlSheet.Range("F" & n).Value
temp02 = xlSheet.Range("B" & n).Value 

'if IFF_description is a  numeric field
temp01 = dlookup("IFF_name", "IFF_Descriptions","IFF_description =" & temp02)
' if IFF_description  is a text field
temp01 = dlookup("IFF_name", "IFF_Descriptions","IFF_description = '" & temp02 & "'")

xlSheet.Range("F" & n).Value = temp01
(In case you cannot work out exactly what I've done, in the 2nd alternative I have added single quotes to surround the variable).

HTH,
Chris
 

Users who are viewing this thread

Back
Top Bottom