If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Access > code help

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-18-12, 20:27
manics manics is offline
Registered User
 
Join Date: Dec 2011
Posts: 7
code help

Hello all, I suck a coding, only been using MS access for about a month or so, so far I managed to create this code:Private Sub Command17_Click()

Me.Refresh

Dim stDocName As String

stDocName = "admin_rptOperator Log"
DoCmd.OutputTo acReport, stDocName, acFormatPDF, "L:\Operations\Team Managers\" & DatePart("yyyy", Date_of_Log) & " Operator Log\ " & Employee_Name & ".pdf"

Exit_Command17_Click:
Exit Sub


Err_Command17_Click:
MsgBox Err.Descriptionq
Resume Exit_Command17_Click

End Sub

I have 1 issue/ 1 questions:

issue 1- the code works great, it saves the file withthe employee name to the correspondent folder (2012 etc..) issue here is if on my form i input something from this year (2012) it saves it great but it also saves everything from 2011 on the same file (employee_name.pdf with all his records from past and present year) all i want to accomplish is for it to save the files from 2011 on the 2011 folder and 2012 on its folder with the same employee name but different year records.

questions: is there a way that i can add something to the current code above that will make MS Access create a folder automatically with the employee name and save the employee file inside with his record ( that way seems easy for me because i can have access save the employee record with the file id at the end on its own folder as individual files)

any help will be appreciated.
Reply With Quote
  #2 (permalink)  
Old 01-20-12, 06:28
Sinndho Sinndho is offline
Registered User
 
Join Date: Mar 2009
Posts: 3,446
The MkDir instruction creates a folder at the specified location:
Code:
MkDir "C:\Documents and Settings\Sinndho\My documents\Access\NewFolder"
__________________
Have a nice day!
Reply With Quote
  #3 (permalink)  
Old 01-21-12, 12:35
Missinglinq Missinglinq is offline
Registered User
 
Join Date: Jun 2005
Location: Richmond, Virginia USA
Posts: 1,702
Just out of curiosity, what are you attempting to do with this line of code:

Me.Refresh

I ask because Refresh is frequently misunderstood. Directly from Access Help:

The Refresh method immediately updates the records in the underlying record source for a specified form or datasheet to reflect changes made to the data by you and other users in a multiuser environment.

The Refresh method shows only changes made to records in the current set. Since the Refresh method doesn't actually requery the database, the current set won't include records that have been added or exclude records that have been deleted since the database was last requeried. Nor will it exclude records that no longer satisfy the criteria of the query or filter. To requery the database, use the Requery method. When the record source for a form is requeried, the current set of records will accurately reflect all data in the record source.

Linq ;0)>
__________________
Hope this helps!

The Devil's in the Details!!

All posts/responses based on Access 2000/2003
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On