Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!

creating a folder

Discussion in 'Information Technology' started by jmillerWV, Jul 28, 2006.

  1. jmillerWV

    jmillerWV
    Expand Collapse
    Guest

    Hi all!
    I am having a brain melt. Is there a way in Access2k to have vb create a
    file folder on a hard drive? What I am trying to do is when an order is
    generated in Access a folder is created using the order number and a copy of
    the Access generated order is placed in the folder. I can move the order with
    no problem to an established folder, but I need to be able to create a folder
    on the fly. Thanks in advance for any assistance, If I have placed this post
    in the wrong area please let me know and I will repost in the proper area.
    jmillerwv
     
  2. Loading...

    Similar Threads Forum Date
    Canada Ottawa weighs creating ambassador for religious freedom Breaking News Oct 4, 2011
    India SGPC Accused of Creating a Row Breaking News Jan 20, 2011
    Pacific International Gathering of Young Sikhs Focuses on Creating Good Citizens Breaking News Jan 8, 2011
    Are We Creating New Devtas? Sikh Sikhi Sikhism Aug 21, 2009
    Sikh News Sharif warns against creating instability in Punjab (Express India) Breaking News Sep 19, 2008

  3. '69 Camaro

    '69 Camaro
    Expand Collapse
    Guest

    Hi.

    > Is there a way in Access2k to have vb create a
    > file folder on a hard drive?


    Yes. Try:

    MkDir "C:\Work\MyNewDir"

    .. . . where C:\Work is the path, and MyNewDir is the name of the new
    directory you wish to create.

    HTH.
    Gunny

    See http://www.QBuilt.com for all your database needs.
    See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials.
    http://www.Access.QBuilt.com/html/expert_contributors2.html for contact
    info.


    "jmillerWV" <jmillerWV@discussions.microsoft.com> wrote in message
    news:02AFCD86-0AB6-40B1-BCFB-5675C4F69F1B@microsoft.com...
    > Hi all!
    > I am having a brain melt. Is there a way in Access2k to have vb create a
    > file folder on a hard drive? What I am trying to do is when an order is
    > generated in Access a folder is created using the order number and a copy
    > of
    > the Access generated order is placed in the folder. I can move the order
    > with
    > no problem to an established folder, but I need to be able to create a
    > folder
    > on the fly. Thanks in advance for any assistance, If I have placed this
    > post
    > in the wrong area please let me know and I will repost in the proper area.
    > jmillerwv
     
  4. jmillerWV

    jmillerWV
    Expand Collapse
    Guest

    Hi,
    Thanks for the quick response. I thank you for the suggestion but I have one
    other question How is it used? Wiht the docmd action or as just a statement
    is VB? Only way I could get it to work was using the command promt. Again
    thank you for your assistance.
    jmillerwv

    "'69 Camaro" wrote:

    > Hi.
    >
    > > Is there a way in Access2k to have vb create a
    > > file folder on a hard drive?

    >
    > Yes. Try:
    >
    > MkDir "C:\Work\MyNewDir"
    >
    > .. . . where C:\Work is the path, and MyNewDir is the name of the new
    > directory you wish to create.
    >
    > HTH.
    > Gunny
    >
    > See http://www.QBuilt.com for all your database needs.
    > See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials.
    > http://www.Access.QBuilt.com/html/expert_contributors2.html for contact
    > info.
    >
    >
    > "jmillerWV" <jmillerWV@discussions.microsoft.com> wrote in message
    > news:02AFCD86-0AB6-40B1-BCFB-5675C4F69F1B@microsoft.com...
    > > Hi all!
    > > I am having a brain melt. Is there a way in Access2k to have vb create a
    > > file folder on a hard drive? What I am trying to do is when an order is
    > > generated in Access a folder is created using the order number and a copy
    > > of
    > > the Access generated order is placed in the folder. I can move the order
    > > with
    > > no problem to an established folder, but I need to be able to create a
    > > folder
    > > on the fly. Thanks in advance for any assistance, If I have placed this
    > > post
    > > in the wrong area please let me know and I will repost in the proper area.
    > > jmillerwv

    >
    >
    >
     
  5. Ron2006

    Ron2006
    Expand Collapse
    Guest

    It works fine in VBA.

    Ron
     
  6. '69 Camaro

    '69 Camaro
    Expand Collapse
    Guest

    Hi.

    > How is it used?


    For future reference, post questions in the newsgroup for new users, since
    the answers there are geared for beginners, and the responders don't assume
    you will understand the directions given:

    http://www.microsoft.com/office/com...ft.public.access.gettingstarted&lang=en&cr=US

    If you post questions in the other Access newsgroups, like this one, it's
    assumed that you are not a beginner (otherwise, you would have posted in the
    new users newsgroup), so the answers given expect you to have at least some
    experience with Access. However, we're happy to provide step-by-step
    instructions to clarify any concepts you don't understand, but those
    step-by-step instructions won't be offered on the first post like they would
    be for beginners in the new users newsgroup, because experienced users don't
    need the extra help.

    The suggested code should be saved inside a VBA procedure in your database
    application. Press <ALT><F11> to open the VB Editor. Select the Insert ->
    Module menu to create a new module. Paste the following code into this new
    module:

    Public Function createNewDir(sPath As String, sNewDir As String) As Boolean

    On Error GoTo ErrHandler

    MkDir sPath & "\" & sNewDir
    createNewDir = True

    Exit Function

    ErrHandler:

    MsgBox "Error in createNewDir( )." & vbCrLf & vbCrLf & _
    "Error #" & Err.Number & vbCrLf & Err.Description
    Err.Clear
    createNewDir = False

    End Function

    Save and compile the code. Name the new module anything other than an
    object already in the database application and other than the name of a
    procedure in any code module. Now, since it's a public function, it can be
    called from VBA code, a macro, or a property elsewhere. As an example, the
    following procedure could be used:

    Public Sub testNewDir()

    On Error GoTo ErrHandler

    Dim sOrderNum As String
    Dim fSuccess As Boolean

    sOrderNum = "123" ' Use whatever function you have to generate the
    order #.
    fSuccess = createNewDir(CurrentProject.Path, sOrderNum)
    MsgBox "Directory created successfully = " & fSuccess

    Exit Sub

    ErrHandler:

    MsgBox "Error in testNewDir( )." & vbCrLf & vbCrLf & _
    "Error #" & Err.Number & vbCrLf & Err.Description
    Err.Clear

    End Sub

    .. . . where CurrentProject.Path is the current directory where your database
    application is located. This could be replaced with another directory path
    by using either a string variable or a hard-coded string, such as
    "C:\Work\MyDir" like the following:

    fSuccess = createNewDir("C:\Work\MyDir", sOrderNum)

    .. . . which would create the C:\Work\MyDir\123 directory.


    HTH.
    Gunny

    See http://www.QBuilt.com for all your database needs.
    See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials.
    http://www.Access.QBuilt.com/html/expert_contributors2.html for contact
    info.


    "jmillerWV" <jmillerWV@discussions.microsoft.com> wrote in message
    news:0477157C-BC45-4DAE-821D-48E843559550@microsoft.com...
    > Hi,
    > Thanks for the quick response. I thank you for the suggestion but I have
    > one
    > other question How is it used? Wiht the docmd action or as just a
    > statement
    > is VB? Only way I could get it to work was using the command promt. Again
    > thank you for your assistance.
    > jmillerwv
    >
    > "'69 Camaro" wrote:
    >
    >> Hi.
    >>
    >> > Is there a way in Access2k to have vb create a
    >> > file folder on a hard drive?

    >>
    >> Yes. Try:
    >>
    >> MkDir "C:\Work\MyNewDir"
    >>
    >> .. . . where C:\Work is the path, and MyNewDir is the name of the new
    >> directory you wish to create.
    >>
    >> HTH.
    >> Gunny
    >>
    >> See http://www.QBuilt.com for all your database needs.
    >> See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials.
    >> http://www.Access.QBuilt.com/html/expert_contributors2.html for contact
    >> info.
    >>
    >>
    >> "jmillerWV" <jmillerWV@discussions.microsoft.com> wrote in message
    >> news:02AFCD86-0AB6-40B1-BCFB-5675C4F69F1B@microsoft.com...
    >> > Hi all!
    >> > I am having a brain melt. Is there a way in Access2k to have vb create
    >> > a
    >> > file folder on a hard drive? What I am trying to do is when an order is
    >> > generated in Access a folder is created using the order number and a
    >> > copy
    >> > of
    >> > the Access generated order is placed in the folder. I can move the
    >> > order
    >> > with
    >> > no problem to an established folder, but I need to be able to create a
    >> > folder
    >> > on the fly. Thanks in advance for any assistance, If I have placed this
    >> > post
    >> > in the wrong area please let me know and I will repost in the proper
    >> > area.
    >> > jmillerwv

    >>
    >>
    >>
     
  7. jmillerWV

    jmillerWV
    Expand Collapse
    Guest

    Hi.
    Again thank you for your assistance na dquick response. I will try as per
    your example and I apologize for posting in the wrong area. Again thank you
    for your assistance and God bless.

    jmillerwv

    "'69 Camaro" wrote:

    > Hi.
    >
    > > How is it used?

    >
    > For future reference, post questions in the newsgroup for new users, since
    > the answers there are geared for beginners, and the responders don't assume
    > you will understand the directions given:
    >
    > http://www.microsoft.com/office/com...ft.public.access.gettingstarted&lang=en&cr=US
    >
    > If you post questions in the other Access newsgroups, like this one, it's
    > assumed that you are not a beginner (otherwise, you would have posted in the
    > new users newsgroup), so the answers given expect you to have at least some
    > experience with Access. However, we're happy to provide step-by-step
    > instructions to clarify any concepts you don't understand, but those
    > step-by-step instructions won't be offered on the first post like they would
    > be for beginners in the new users newsgroup, because experienced users don't
    > need the extra help.
    >
    > The suggested code should be saved inside a VBA procedure in your database
    > application. Press <ALT><F11> to open the VB Editor. Select the Insert ->
    > Module menu to create a new module. Paste the following code into this new
    > module:
    >
    > Public Function createNewDir(sPath As String, sNewDir As String) As Boolean
    >
    > On Error GoTo ErrHandler
    >
    > MkDir sPath & "\" & sNewDir
    > createNewDir = True
    >
    > Exit Function
    >
    > ErrHandler:
    >
    > MsgBox "Error in createNewDir( )." & vbCrLf & vbCrLf & _
    > "Error #" & Err.Number & vbCrLf & Err.Description
    > Err.Clear
    > createNewDir = False
    >
    > End Function
    >
    > Save and compile the code. Name the new module anything other than an
    > object already in the database application and other than the name of a
    > procedure in any code module. Now, since it's a public function, it can be
    > called from VBA code, a macro, or a property elsewhere. As an example, the
    > following procedure could be used:
    >
    > Public Sub testNewDir()
    >
    > On Error GoTo ErrHandler
    >
    > Dim sOrderNum As String
    > Dim fSuccess As Boolean
    >
    > sOrderNum = "123" ' Use whatever function you have to generate the
    > order #.
    > fSuccess = createNewDir(CurrentProject.Path, sOrderNum)
    > MsgBox "Directory created successfully = " & fSuccess
    >
    > Exit Sub
    >
    > ErrHandler:
    >
    > MsgBox "Error in testNewDir( )." & vbCrLf & vbCrLf & _
    > "Error #" & Err.Number & vbCrLf & Err.Description
    > Err.Clear
    >
    > End Sub
    >
    > .. . . where CurrentProject.Path is the current directory where your database
    > application is located. This could be replaced with another directory path
    > by using either a string variable or a hard-coded string, such as
    > "C:\Work\MyDir" like the following:
    >
    > fSuccess = createNewDir("C:\Work\MyDir", sOrderNum)
    >
    > .. . . which would create the C:\Work\MyDir\123 directory.
    >
    >
    > HTH.
    > Gunny
    >
    > See http://www.QBuilt.com for all your database needs.
    > See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials.
    > http://www.Access.QBuilt.com/html/expert_contributors2.html for contact
    > info.
    >
    >
    > "jmillerWV" <jmillerWV@discussions.microsoft.com> wrote in message
    > news:0477157C-BC45-4DAE-821D-48E843559550@microsoft.com...
    > > Hi,
    > > Thanks for the quick response. I thank you for the suggestion but I have
    > > one
    > > other question How is it used? Wiht the docmd action or as just a
    > > statement
    > > is VB? Only way I could get it to work was using the command promt. Again
    > > thank you for your assistance.
    > > jmillerwv
    > >
    > > "'69 Camaro" wrote:
    > >
    > >> Hi.
    > >>
    > >> > Is there a way in Access2k to have vb create a
    > >> > file folder on a hard drive?
    > >>
    > >> Yes. Try:
    > >>
    > >> MkDir "C:\Work\MyNewDir"
    > >>
    > >> .. . . where C:\Work is the path, and MyNewDir is the name of the new
    > >> directory you wish to create.
    > >>
    > >> HTH.
    > >> Gunny
    > >>
    > >> See http://www.QBuilt.com for all your database needs.
    > >> See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials.
    > >> http://www.Access.QBuilt.com/html/expert_contributors2.html for contact
    > >> info.
    > >>
    > >>
    > >> "jmillerWV" <jmillerWV@discussions.microsoft.com> wrote in message
    > >> news:02AFCD86-0AB6-40B1-BCFB-5675C4F69F1B@microsoft.com...
    > >> > Hi all!
    > >> > I am having a brain melt. Is there a way in Access2k to have vb create
    > >> > a
    > >> > file folder on a hard drive? What I am trying to do is when an order is
    > >> > generated in Access a folder is created using the order number and a
    > >> > copy
    > >> > of
    > >> > the Access generated order is placed in the folder. I can move the
    > >> > order
    > >> > with
    > >> > no problem to an established folder, but I need to be able to create a
    > >> > folder
    > >> > on the fly. Thanks in advance for any assistance, If I have placed this
    > >> > post
    > >> > in the wrong area please let me know and I will repost in the proper
    > >> > area.
    > >> > jmillerwv
    > >>
    > >>
    > >>

    >
    >
    >
     
  8. '69 Camaro

    '69 Camaro
    Expand Collapse
    Guest

    You're very welcome.

    > and I apologize for posting in the wrong area.


    No problem. There aren't any sign posts to tell you that beginners get the
    best service in the new users newsgroup
    (microsoft.public.access.gettingstarted), experts get the best service in
    the programming and queries newsgroups
    (microsoft.public.access.modulesdaovba and microsoft.public.access.queries),
    and intermediate through advanced users get the best service in the other
    Access newsgroups. And the regulars complained about the sign posts telling
    questioners how to get the fastest free service in these newsgroups, so you
    won't even find those anymore.

    HTH.
    Gunny

    See http://www.QBuilt.com for all your database needs.
    See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials.
    http://www.Access.QBuilt.com/html/expert_contributors2.html for contact
    info.


    "jmillerWV" <jmillerWV@discussions.microsoft.com> wrote in message
    news:926819A4-28F7-4365-8239-BFDD377A0768@microsoft.com...
    > Hi.
    > Again thank you for your assistance na dquick response. I will try as per
    > your example and I apologize for posting in the wrong area. Again thank
    > you
    > for your assistance and God bless.
    >
    > jmillerwv
    >
    > "'69 Camaro" wrote:
    >
    >> Hi.
    >>
    >> > How is it used?

    >>
    >> For future reference, post questions in the newsgroup for new users,
    >> since
    >> the answers there are geared for beginners, and the responders don't
    >> assume
    >> you will understand the directions given:
    >>
    >> http://www.microsoft.com/office/com...ft.public.access.gettingstarted&lang=en&cr=US
    >>
    >> If you post questions in the other Access newsgroups, like this one, it's
    >> assumed that you are not a beginner (otherwise, you would have posted in
    >> the
    >> new users newsgroup), so the answers given expect you to have at least
    >> some
    >> experience with Access. However, we're happy to provide step-by-step
    >> instructions to clarify any concepts you don't understand, but those
    >> step-by-step instructions won't be offered on the first post like they
    >> would
    >> be for beginners in the new users newsgroup, because experienced users
    >> don't
    >> need the extra help.
    >>
    >> The suggested code should be saved inside a VBA procedure in your
    >> database
    >> application. Press <ALT><F11> to open the VB Editor. Select the
    >> Insert ->
    >> Module menu to create a new module. Paste the following code into this
    >> new
    >> module:
    >>
    >> Public Function createNewDir(sPath As String, sNewDir As String) As
    >> Boolean
    >>
    >> On Error GoTo ErrHandler
    >>
    >> MkDir sPath & "\" & sNewDir
    >> createNewDir = True
    >>
    >> Exit Function
    >>
    >> ErrHandler:
    >>
    >> MsgBox "Error in createNewDir( )." & vbCrLf & vbCrLf & _
    >> "Error #" & Err.Number & vbCrLf & Err.Description
    >> Err.Clear
    >> createNewDir = False
    >>
    >> End Function
    >>
    >> Save and compile the code. Name the new module anything other than an
    >> object already in the database application and other than the name of a
    >> procedure in any code module. Now, since it's a public function, it can
    >> be
    >> called from VBA code, a macro, or a property elsewhere. As an example,
    >> the
    >> following procedure could be used:
    >>
    >> Public Sub testNewDir()
    >>
    >> On Error GoTo ErrHandler
    >>
    >> Dim sOrderNum As String
    >> Dim fSuccess As Boolean
    >>
    >> sOrderNum = "123" ' Use whatever function you have to generate the
    >> order #.
    >> fSuccess = createNewDir(CurrentProject.Path, sOrderNum)
    >> MsgBox "Directory created successfully = " & fSuccess
    >>
    >> Exit Sub
    >>
    >> ErrHandler:
    >>
    >> MsgBox "Error in testNewDir( )." & vbCrLf & vbCrLf & _
    >> "Error #" & Err.Number & vbCrLf & Err.Description
    >> Err.Clear
    >>
    >> End Sub
    >>
    >> .. . . where CurrentProject.Path is the current directory where your
    >> database
    >> application is located. This could be replaced with another directory
    >> path
    >> by using either a string variable or a hard-coded string, such as
    >> "C:\Work\MyDir" like the following:
    >>
    >> fSuccess = createNewDir("C:\Work\MyDir", sOrderNum)
    >>
    >> .. . . which would create the C:\Work\MyDir\123 directory.
    >>
    >>
    >> HTH.
    >> Gunny
    >>
    >> See http://www.QBuilt.com for all your database needs.
    >> See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials.
    >> http://www.Access.QBuilt.com/html/expert_contributors2.html for contact
    >> info.
    >>
    >>
    >> "jmillerWV" <jmillerWV@discussions.microsoft.com> wrote in message
    >> news:0477157C-BC45-4DAE-821D-48E843559550@microsoft.com...
    >> > Hi,
    >> > Thanks for the quick response. I thank you for the suggestion but I
    >> > have
    >> > one
    >> > other question How is it used? Wiht the docmd action or as just a
    >> > statement
    >> > is VB? Only way I could get it to work was using the command promt.
    >> > Again
    >> > thank you for your assistance.
    >> > jmillerwv
    >> >
    >> > "'69 Camaro" wrote:
    >> >
    >> >> Hi.
    >> >>
    >> >> > Is there a way in Access2k to have vb create a
    >> >> > file folder on a hard drive?
    >> >>
    >> >> Yes. Try:
    >> >>
    >> >> MkDir "C:\Work\MyNewDir"
    >> >>
    >> >> .. . . where C:\Work is the path, and MyNewDir is the name of the new
    >> >> directory you wish to create.
    >> >>
    >> >> HTH.
    >> >> Gunny
    >> >>
    >> >> See http://www.QBuilt.com for all your database needs.
    >> >> See http://www.Access.QBuilt.com for Microsoft Access tips and
    >> >> tutorials.
    >> >> http://www.Access.QBuilt.com/html/expert_contributors2.html for
    >> >> contact
    >> >> info.
    >> >>
    >> >>
    >> >> "jmillerWV" <jmillerWV@discussions.microsoft.com> wrote in message
    >> >> news:02AFCD86-0AB6-40B1-BCFB-5675C4F69F1B@microsoft.com...
    >> >> > Hi all!
    >> >> > I am having a brain melt. Is there a way in Access2k to have vb
    >> >> > create
    >> >> > a
    >> >> > file folder on a hard drive? What I am trying to do is when an order
    >> >> > is
    >> >> > generated in Access a folder is created using the order number and a
    >> >> > copy
    >> >> > of
    >> >> > the Access generated order is placed in the folder. I can move the
    >> >> > order
    >> >> > with
    >> >> > no problem to an established folder, but I need to be able to create
    >> >> > a
    >> >> > folder
    >> >> > on the fly. Thanks in advance for any assistance, If I have placed
    >> >> > this
    >> >> > post
    >> >> > in the wrong area please let me know and I will repost in the proper
    >> >> > area.
    >> >> > jmillerwv
    >> >>
    >> >>
    >> >>

    >>
    >>
    >>
     

Share This Page