Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / December 2005

Tip: Looking for answers? Try searching our database.

Using data stored in VB variables in an update query

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Nicholas Scarpinato - 30 Dec 2005 19:30 GMT
I have a database function I'm trying to create which will upload a batch of
files with a naming convention of "BDMMDDYY.TXT". The upload itself is not a
problem, but I also need to add the transaction date of the file and the date
of the upload to the table as each file is uploaded. The file is uploaded to
a temp table, which the transaction date and current date are then added to
through an update query. However, those queries were originally getting their
update dates from a form. Now I want to run them through my auto-upload code,
and they error out because the form is not open. Is there a way to use the
variables used to get the filenames to be uploaded to generate the date for
the update query as well? The code that gets the filenames looks like this:

strDestinationName = "C:\Import\" & strFileType & strFileDateMonth &
strFileDateDay & "05.txt"

I want to have the update use strFileDateMonth and strFileDateDay to update
the date of the transaction, since these variables control what file is
uploaded, and each file's filename is date-coded. The dates are not contained
in the files. Any suggestions?
TC - 31 Dec 2005 04:58 GMT
If you declared those variables at the top of a standard module (not a
form module) you could refer to them in the query, if I recall
correctly. When I say at the top of the module, I mean /before/ the
subs & functions (if any) in that module.

You do not need to put your actual updating code, in that module. You
just need to declare the relevant variables, there. By "declare" I
mean, their Dim statements.

HTH,
TC
Nicholas Scarpinato - 31 Dec 2005 21:15 GMT
I got this to work by using the code to open and update a field on a form and
then running the query based off the field value, but thanks for the tip
anyway since I'll probably need to know that for future reference.

> If you declared those variables at the top of a standard module (not a
> form module) you could refer to them in the query, if I recall
[quoted text clipped - 7 lines]
> HTH,
> TC
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.