Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Storing a value from an input box for further use

Status
Not open for further replies.

StevieB01

Technical User
Apr 13, 2007
5
GB
I have created an inputbox for users to enter a string. How can I add this value to a query
 
Chrisstiaan,

I have created a module that prompts the user to enter a date in a text format of "yyyymmdd" into an inputbox. the variable is declared as DIM as String.

This variable is then used as part of a file name and destination and is used to import a csv into access and create a table.

I also want that variable to be used to update a field in my table.
 
wouldn't this be best served with a public property

>>the variable is declared as DIM as String

Global variables are bad form. You'll run into problems from the get go using them. Just a thought ;-)

____________ signature below ______________
The worst mistake you'll ever make is to do something simply the way you know how while ignoring the way it should be done
 
Function Positions_History_Download()

On Error GoTo Error_Handler

Dim StaticFileName As String
Dim StrInput As String

DoCmd.SetWarnings False

DoCmd.OpenQuery "Trading_Positions_Delete_Qry", acViewNormal

DoCmd.SetWarnings True


StrInput = InputBox("Enter Required Business Date YYYYMMDD")

StaticFileName = "\\My_Server\FTP\history\Trading_Positions-" + StrInput + ".csv"

DoCmd.TransferText acImportDelim, "Trading_Positions_Import_Spec", "Trading_Positions_Tbl", StaticFileName


MsgBox "Download Complete"

Exit Function

Error_Handler: MsgBox "File Does Not Exist", vbCritical, "WARNING"

Exit Function


End Function
 
That is access code this is the vb.net forum. Please ask your question in one of the access forums.

Christiaan Baes
Belgium

"My old site" - Me
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top