I am new at Access programming, and am having some trouble with some VBA code that I think there probably is a simple solution.
I am trying to set a property on a function that uses a variable from a query.
Here is what I have so far:
The issue is that it does not translate "product" as the query value.
I am using the VBA from here in a module to handle the save file dialog box:
access.mvps.org/access/api/api0001.htm
Any help is appreciated!
I am trying to set a property on a function that uses a variable from a query.
Here is what I have so far:
Code:
Private Sub Command2_Click()
Dim strFilter As String
Dim strInputFileName As String
Dim rst As Recordset
Dim product As String
Dim db As Database
Set db = CurrentDb
Set rst = db.OpenRecordset("SELECT issue_date from [Next issue date]")
With rst
.MoveFirst
product = .Fields(0)
End With
Set rst = Nothing
Set db = Nothing
MsgBox product
'Ask for SaveFileName
strFilter = ahtAddFilterItem(strFilter, "Text Files (*.txt)", "*.TXT")
strSaveFileName = ahtCommonFileOpenSave( _
OpenFile:=False, _
Filter:=strFilter, _
DefaultExt:=".TXT", _
FileName:="product", _
Flags:=ahtOFN_OVERWRITEPROMPT Or ahtOFN_READONLY)
' the issue is right here: it does not translate "product" as the query value
MsgBox strSaveFileName
DoCmd.TransferText acExportFixed, "Complaints", "Complaints to export", strSaveFileName
MsgBox "Saved!"
End Sub
The issue is that it does not translate "product" as the query value.
I am using the VBA from here in a module to handle the save file dialog box:
access.mvps.org/access/api/api0001.htm
Any help is appreciated!