Module to check folder existance

How to wite a module to check folder " Report " exist or not.
If it doesn't exist ,then vba create one.
Later I need to keep my access pdf report to this folder
before attach it to my email.

thank's


0
rahmad
1/31/2008 3:32:45 AM
access.formscoding 7493 articles. 0 followers. Follow

3 Replies
743 Views

Similar Articles

[PageSpeed] 30

See:
    FileExists() and FolderExists() functions
at:
    http://allenbrowne.com/func-11.html

If the folder does not exist, use MkDir to create it.

-- 
Allen Browne - Microsoft MVP.  Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"rahmad" <chooriang@gmail.com> wrote in message
news:u%23$Blo7YIHA.5028@TK2MSFTNGP04.phx.gbl...
> How to wite a module to check folder " Report " exist or not.
> If it doesn't exist ,then vba create one.
> Later I need to keep my access pdf report to this folder
> before attach it to my email.
0
Allen
1/31/2008 6:51:15 AM
Dear Mr Allen,
I've read your tip ( for progammer ),but I still need guidance ( as
beginner )
Below are my code :
    Dim strPath As String
    Dim strModel As String
    Dim strLotNo As String

    strPath = Application.CurrentProject.Path
    strModel = Me.Model
    strLotNo = Me.LotNo

        If Me.[Rotation speed No].Value = 1 Or _
    Me.[Rotation speed No].Value = 4 Then
    DoCmd.SetWarnings False
    DoCmd.OpenQuery "Retrieved data access prt_qry", acViewNormal
    DoCmd.OutputTo acOutputReport, "Electrical Report 1", acFormatSNP,
strPath & "/" & strModel & " Lot no " & strLotNo & ".snp", True
    DoCmd.OpenQuery "Append email log_qry", acViewNormal
    DoCmd.SetWarnings True
    Else
    DoCmd.SetWarnings False
    DoCmd.OpenQuery "Retrieved data access prt_qry", acViewNormal
    DoCmd.OutputTo acOutputReport, "Electrical Report ", acFormatSNP,
strPath & "/" & strModel & " Lot no " & strLotNo & ".snp", True
    DoCmd.OpenQuery "Append email log_qry", acViewNormal
    DoCmd.SetWarnings True
        End If

How and where to put your code.Let say i wanna have folder 'Result' beside
my DB.
How start writing the code.
And please explain about MkDir.

> If the folder does not exist, use MkDir to create it.

Thank's


"Allen Browne" <AllenBrowne@SeeSig.Invalid> wrote in message
news:ejbouW9YIHA.748@TK2MSFTNGP04.phx.gbl...
> See:
>     FileExists() and FolderExists() functions
> at:
>     http://allenbrowne.com/func-11.html
>
> If the folder does not exist, use MkDir to create it.
>
> --
> Allen Browne - Microsoft MVP.  Perth, Western Australia
> Tips for Access users - http://allenbrowne.com/tips.html
> Reply to group, rather than allenbrowne at mvps dot org.
>
> "rahmad" <chooriang@gmail.com> wrote in message
> news:u%23$Blo7YIHA.5028@TK2MSFTNGP04.phx.gbl...
> > How to wite a module to check folder " Report " exist or not.
> > If it doesn't exist ,then vba create one.
> > Later I need to keep my access pdf report to this folder
> > before attach it to my email.


0
rahmad
2/3/2008 12:28:37 PM
Hi.

I can't write your code for you.

I can suggest a FolderExists() function like this:

    Function FolderExists(strPath As String) As Boolean
        On Error Resume Next
        FolderExists = ((GetAttr(strPath) And vbDirectory) = vbDirectory)
    End Function

It goes in a Standard module. To get there, select the Modules tab of the 
Database window, and click New.

-- 
Allen Browne - Microsoft MVP.  Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"rahmad" <chooriang@gmail.com> wrote in message
news:%23QFJACmZIHA.4712@TK2MSFTNGP05.phx.gbl...
> Dear Mr Allen,
> I've read your tip ( for progammer ),but I still need guidance ( as
> beginner )
> Below are my code :
>    Dim strPath As String
>    Dim strModel As String
>    Dim strLotNo As String
>
>    strPath = Application.CurrentProject.Path
>    strModel = Me.Model
>    strLotNo = Me.LotNo
>
>        If Me.[Rotation speed No].Value = 1 Or _
>    Me.[Rotation speed No].Value = 4 Then
>    DoCmd.SetWarnings False
>    DoCmd.OpenQuery "Retrieved data access prt_qry", acViewNormal
>    DoCmd.OutputTo acOutputReport, "Electrical Report 1", acFormatSNP,
> strPath & "/" & strModel & " Lot no " & strLotNo & ".snp", True
>    DoCmd.OpenQuery "Append email log_qry", acViewNormal
>    DoCmd.SetWarnings True
>    Else
>    DoCmd.SetWarnings False
>    DoCmd.OpenQuery "Retrieved data access prt_qry", acViewNormal
>    DoCmd.OutputTo acOutputReport, "Electrical Report ", acFormatSNP,
> strPath & "/" & strModel & " Lot no " & strLotNo & ".snp", True
>    DoCmd.OpenQuery "Append email log_qry", acViewNormal
>    DoCmd.SetWarnings True
>        End If
>
> How and where to put your code.Let say i wanna have folder 'Result' beside
> my DB.
> How start writing the code.
> And please explain about MkDir.
>
>> If the folder does not exist, use MkDir to create it.
>
> Thank's
>
>
> "Allen Browne" <AllenBrowne@SeeSig.Invalid> wrote in message
> news:ejbouW9YIHA.748@TK2MSFTNGP04.phx.gbl...
>> See:
>>     FileExists() and FolderExists() functions
>> at:
>>     http://allenbrowne.com/func-11.html
>>
>> If the folder does not exist, use MkDir to create it.
>>
>> --
>> Allen Browne - Microsoft MVP.  Perth, Western Australia
>> Tips for Access users - http://allenbrowne.com/tips.html
>> Reply to group, rather than allenbrowne at mvps dot org.
>>
>> "rahmad" <chooriang@gmail.com> wrote in message
>> news:u%23$Blo7YIHA.5028@TK2MSFTNGP04.phx.gbl...
>> > How to wite a module to check folder " Report " exist or not.
>> > If it doesn't exist ,then vba create one.
>> > Later I need to keep my access pdf report to this folder
>> > before attach it to my email.
>
> 

0
Allen
2/3/2008 1:05:40 PM
Reply:

Similar Artilces:

How to check record exists before INSERT multiple records
Hi Im a SQL Server newbie and am a bit confused by the number of different methods I have seen posted on the web about approaching this problem. I am using SQL Server 2005 and I have about 500 records defined in simple terms for brevity: ID | EMAIL | NAME | etc I have generated INSERT statements for all the records via Management Studio | Tasks | Generate Scripts. Im migrating this data to anotaher db that already has records and there are some duplicates with my data. I need to do a check that the record does not exist and then do an INSERT if not (Im not doing an...

mail enabled public folders #5
Hi, I am having problems receiving emails sent from outside the organization to a mail enabled public folder. My setup is a FE\BE scenario running 2003. I have applied tracking to try and work out why the emails are not being delivered and this is what it says: Message scheduled to retry local delivery. Then it just keeps logging this message over and over again. The Public folder resides on the BE server but there is no mention on the logs that the FE server is delivering it to the BE server. So to me it looks as though the FE server is trying to deliver it to itself. There is no re...

How to append records in exist XMl file?
Greetings I want to append records in a XML file,I use XMLTextWriter,but i found it only create a XML file,not append records in exist XML file.why? ------------------------------------------------- XmlTextWriter myXmlTextWrite = new XmlTextWriter(@"C:\myconfig.xml"); myXmlTextWrite.WriteStartDocument(); myXmlTextWrite.WriteStartElement("Record"); myXmlTextWrite.WriteStartElement("Topic"); myXmlTextWrite.WriteString(XMLTopic); myXmlTextWrite.WriteEndElement(); myXmlTextWrite.WriteEndElement(); //end Record myXmlTextWrite.WriteEndDocument(); myXmlTextWrite.Flush(...

CHange Default Save Folder in Outlook 2003
I would like to change my default save folder in Outlook 2003. I have tried adding a string value to my registry key but it did not change anything. Is there another way to change the default save folder other than editing the registry? This forum is for Microsoft Access Databases. You will have more success if you post your question in an Outlook related forum. Regards "StephStars" <StephStars@discussions.microsoft.com> wrote in message news:4951264B-AE37-410B-BCD5-10571F25C19B@microsoft.com... >I would like to change my default save folder in Outlook ...

Printing on an existing postcard??
Hi, I'm trying to design a postcard using Publisher 2000, using an existing postcard with information already on it. I want to add information and use the mail merge to print off over 100 of these (it's for a wedding update). I tried to set something up but Publisher's postcards are much smaller than the ones I have and the design comes out too small. Any suggestions on how to set it up right so that I can create these "Save the Date" cards? On 19 Apr 2004 11:36, "=?Utf-8?B?UGF0cmljaw==?=" <pkollar78@yahoo.com> wrote: >Hi, I'm trying to design a...

Server 2003, Some user can't access folder and some use can't see file
Hi all We have 20 PCs all has install XP and one has server 2003. We have set 3 groups for user 12 / user 5 / user 3. And each group has difference policy. Now we have some problem Here On user 12 group. Few user they can't access some files from share folder, few user can't see some folder. Like the use Raj, Jack, Jena, Gita, Rita, Sonali, Mona, Mina, Mack, John, Bob, Akash We have folder like this way Project Server-> (share folder) |-> Final Files |-> Old Files |-> Temp Files ...

Public folder rule to auto reply to a message
Posted a question the other day about a public folder sending an auto reply when a message hits the folder. Was told to add the send as permission for the user to that folder. I did this and using the folder assistant set up a rule which sends successfully to internal mail accounts but not to outside clients. What am I doing wrong. I have the send as permission on the Exchange public folder applied but external email addresses dont get the message. Help please Im going nuts. -- Kath If you turn on message tracking what happens to the outbound mail? Does it get stuck? Nue "K...

WLM Online Folders via POP
I have quite a few "online" folders with my MSN mailbox that I use for filing mail in my account. These folders are in the same area as my MSN Inbox and are not "Storage Folders" on my local PC. I can access these folders via MSN Explorer and also via WLM Desktop and mail.live.com, but when using a different mail client and accessing my MSN email via POP (at pop3.live.com). Is there any way to access these folders outside of MSN Explorer, WLM Desktop, or mail.live.com? A screenshot of my folders is located at: http://www.ginab.net/images/folders.jpg ...

Public Folders & sharing violations
Exchange 2003 (sbs) with Excel files in public folders. Multiple users can open same file at same time and not get message that file is opened by someone else until they attempt to save it. This was not case before upgrade from Exchange 2000. How can we force the files in public folders to gave notification that file is already open immediately when another user tries to open it? =?Utf-8?B?Sm9qb3dv?= <Jojowo@discussions.microsoft.com> wrote in news:E64EF503-0662-490B-8513-F08193721353@microsoft.com: > Exchange 2003 (sbs) with Excel files in public folders. Multiple > ...

SBS 2008 + Windows 7 Ultimate slow redirected folders
Hi, Having some issues with SBS 2008 and the Documents folder on clients, which is redirected. Creating or renaming folders is extermly slow; takes about a minute. Copying a file to the network seems fine and happens quickly, although Explorer doesn't refresh and show the files until I hit F5. Copying / refreshing seems normal. Also, my microsoft money file (which is stored in Documents) takes about a minute or two to open. Money hangs for a while, then suddenly it just opens. Any ideas whats going on? Andy Hi Andy: Have you run the SBS BPA - and fixed anything it...

Problem with search queries on public folder
Hello all , I seem to be in the dark a bit as I am not finding a solution very easily for my problem .I am administrating a 50 user network (all using Ms utlook - mixed Outlook 2000 + Outlook 2002 ) . We are using Exchange 2003 on Windows 2003 platform (BDC) , Windows 2003 (PDC). My problem is the Public Folder searches (or find utility) .When a user wants to use the basic find firstly it returns no result (that is easy to understand because I think it is not defaulted to the Public Folder that everyone works on ) - 1stly is there any method of setting my default "find/search folder&qu...

Edit Payables Check Batch
If when in Select Payables Checks, you forget to uncheck Automatically Apply Existing Unapplied checkbox for say Return & Credit Memo can you unapply them in the Edit Payables Check window? What is the best way to unapply them. Thanks hd high quality Soccer jerseys NBA Jersey tracksuit and jackets, GHD hairstraightener supplier from www.willpa.com Are you a Retail businessman who bother by the purchase price? China Cheapest TOP wholesale website can help you we are specialize in replica sport goods manufacturing in china, we can offer you all kinds of soccer jersey, NBA jerse...

VBA to check omissions and show/hide form
Hello, all. I have a macro where I want it to check 5 columns on each line for errors and if there are needed corrections then show the user form, if not, to continue. I keep receiving an Object Error message at the "frm.Hide" line. Range("A2").Select TotalRowsToDo = ActiveCell.CurrentRegion.Rows.Count Counter = 1 Do Until Counter = TotalRowsToDo If Len(ActiveCell.Offset(0, 2).Value) <> 4 Then frm.Show Else If Len(ActiveCell.Offset(0, 3).Value) <> 4 Then frm.Show Else If Len(ActiveCell.Offse...

Check/Unchek in PopUp Menu -- Tick mark is not toggleing
Hi I am displaying a Pop Up menu on right click of List Control's Header(CListCtrl). This popup menu is having Check/Tick marks. But they are not toggleing on subsequent clicks. I am using CMenu's CheckMenuItem( ) function. Can anybody please help me? Thanx in Advance... My Code looks like.... The first Function is displaying popup menu. The second funtion is handling the click on menuitems. The code for Toggleing Check/Tick mark is in second one. BOOL CWitPlayerDlg::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult) { LPN...

check book reconciliation
Is there a way to undo or reverse a bank rec in GP. We did not have good information and did not enter all outstanding checks and deposits when we started using great plains. We processed May rec and enter adjustments to allow for the outstanding balances but it has overstated our checkbook balance and we need to reverse the rec and enter those outstanding checks. We are using GP 10.0 No, you can't reverse a bank rec. However, you can do multiple reconciliations for the same period. Go ahead and enter the missing transactions and then perform a second bank rec to get your rec...

Apply rule only on specific folder
Outlook has numerous option for rules but apparently not to work on items in a specific folder. My need is to forward some items from the Inbox to a different email address when working with the WebAccess interface (Microsoft Exchange). The easiest solution seemed to select the items and drag them to a specified folder ON WHICH one apply a general forwarding rule. When setting the rule it can be applied one time to the specific folder but from there on works directly on the Inbox, with result of getting all mails forwarded. Thanks You can't assign a rule to a folder. You c...

Use Javascripts to check value in text box
I am new in Javascripts. I want to code javascripts to check some text boxes value in code behind form. (I knew how to use vb to check but in this case, I need JS) Can someone help me? For example, I want to use js to check value in txtOrderProduct, txtOrderBy, if both of text boxes are blank then fire alert function. -- Message posted via http://www.dotnetmonster.com "aspfun via DotNetMonster.com" <u53138@uwe> wrote in message news:a45c91a52bfd1@uwe... > I want to code a JavaScript to check the value of some text boxes in code behind form. Fi...

Banner drop-down folder list in OL2003
I, like many others, greatly miss the banner drop-down folder list found in previous versions of Outlook. This function allowed a user to utilize the full width of their screen for the purpose at hand while still offering the user a quick method for "jumping" to ANY other folder item, including file system objects. The new GO menu only offers switching to other main function groups. Navigation is only needed when one needs to navigate and therefore should be hidden until it is needed, IMHO. I found a thread from November 2003 (link below) which seemed to indicate that I should s...

Deleted Items do not show in Deleted Items folder
Deleted items have stopped showing up in the Deleted Items folder. I am running the latest version of WLM. This is a imap.gmail.com account. I have the View>Show or Hide>Show deleted items checked. Thoughts/Help? They're not supposed to when you use GMail IMAP. Tell me... how are you deleting messages and how you set you your IMAP acct on WLM. The correct way is to "move" or "drag" them to the Gmail Trash folder. If you are using the Delete key or clicking Delete on the menu, you are actually archiving the messages, and you will still find them unde...

Extracting folder data / Outlook won't open
I can't open Outlook, because it doesn't recognize Outlook Express is installed (I have the often reported, but apparently rarely solved, msoe.dll problem). Is there a way to pull the mountains of data (calendar, tasks, contacts and saved messages) out of my Outlook data file from another PIM program? I'm willing to go with any other program to get away from buggy Outlook, and figure one of the third-party sync programs will handle the issue of how to sync with my Pocket PC. augusthelmbright@msn.com, you wrote on 23 Mar 2007 14:57:55 -0700: > I can't open Outlook, beca...

Outlook 2007
I use Windows Vista Home Premium SP1 Office 2007, Outlook 2007 Outlook 2007 - sent messages appear in "sent message" folder in different account All my sent messages appear in different folder of another account that I have setup in Outlook. Can someone help me with proper setup so all my sent messages from one account are saved in "sent message" folder of that particular account and not in another account? I have two accounts in Outlook 2007. One is my private email folder called abc folder and another one is used for biz called xyz folder. When I sen...

Searching Contacts in Mailbox and Contacts in Personal Folder in Outlook 2003
Hello, I work in Outlook 2003 tied into an Exchange server. When I press F11 to do a contact lookup I only get results from the Contacts list that is a sub folder of my mailbox. I only keep business contacts in that folder. How can I also search my Contacts folder in my Personal Folder file? Thanks Marc I figured it out. Right click on the Contacts in Personal Folders and enable the Show This Folder As An Email Address Book option. Thanks anyway! ...

Printer keeps asking for non-existent picture
Trying to print page from Publisher Deluxe Version 2002 document. Get message that can't find picture, and there is no picture on the page. I tell it to print without picture but it does not print. Is your printer driver current? Is MS Publisher Image Setter installed? Try using it to see if you get the same behavior. It is always best to completely remove a printer driver before installing/reinstalling. How to clean up printer drivers http://members.shaw.ca/bsanders/CleanPrinterDrivers.htm -- Mary Sauer http://msauer.mvps.org/ "gertrudes" <gertrudes@discussions.mic...

Checking Mailboxes
Recently moved from Exch 5.5 to Exch 2003. Under 5.5 we could log into a workstation as Administrator and then we could reconfigure outlook to any user. We need to do this to be able to check for e-mails when people are not in - we could blank the password and log in that way but it would mean phone calls when the user comes back in and their password is not recognised. I cant seem to be able to check boxes now... any suggestions as to the best way to do it?? at the moment I am blanking out the password so i can log in as them but it is causing me more propblems!!! In Exchange 5.5 ...

"My Documents" folder redirection
Hi folks, I have a SBS 2003 server that I am replacing via swing migration with SBS 2008. I'm also going to be replacing a Server 2003 right after I get the SBS migration complete. The Server 2003 is the recipient of "My Documents" folder redirection via group policy. I will be wanting to change that location to the new Server 2008. Do I just change the group policy pointer, or do I have to "move" the files currently redirected to a path on the new server and then change the pointer, or something completely different? Thanks, Mike There is an op...