B
box2003
The below segments are examples of a problem I am trying to figure out when
the code snips are applied to command buttons. The test fails whether varx
is declared as String or Variant. Please let me know what is wrong here.
Thank you.
Test 1, This works:
Private Sub btn1_Click()
Dim output As String
output = "c:\nsi_dev\test.xls"
DoCmd.OutputTo acOutputTable, "test", acFormatXLS, output
end Sub
Test 2, This does not work:
Private Sub btn1_Click()
Dim varx As variant
varx = DLookup("outputpath", "config")
me.text1 = varx 'produces "C:\nsi_dev\test.xls" in textbox me.text1 as a
result
DoCmd.OutputTo acOutputTable, "test", acFormatXLS, varx
End Sub
the code snips are applied to command buttons. The test fails whether varx
is declared as String or Variant. Please let me know what is wrong here.
Thank you.
Test 1, This works:
Private Sub btn1_Click()
Dim output As String
output = "c:\nsi_dev\test.xls"
DoCmd.OutputTo acOutputTable, "test", acFormatXLS, output
end Sub
Test 2, This does not work:
Private Sub btn1_Click()
Dim varx As variant
varx = DLookup("outputpath", "config")
me.text1 = varx 'produces "C:\nsi_dev\test.xls" in textbox me.text1 as a
result
DoCmd.OutputTo acOutputTable, "test", acFormatXLS, varx
End Sub