PC Review


Reply
Thread Tools Rate Thread

Add records based on folder names

 
 
=?Utf-8?B?RGF2aWQgTSBD?=
Guest
Posts: n/a
 
      13th Apr 2006
I would like to append records to my Jobs table based on the name of folders
in the K:\000Projects\GMJobsFile

Each folder is of the format XXXX - Name where XXXX is the JobNumber and
Name is the JobName

My table structure for Jobs is:

JobNumber - primary key number field
JobName - text field

The code will need to check to see if the job number already exists before
adding it to the database. It will also have to parse the string into
JobNumber and JobName. In Java this would be pretty simple. I'm sure it would
be fairly simple in VB as well but could do with some help getting started.

Thanks

Dave


 
Reply With Quote
 
 
 
 
Alex Dybenko
Guest
Posts: n/a
 
      13th Apr 2006
Hi,
to get folder name - you can use Dir() function, access help has examples
using it

then you have to open recordset, based on your table, set a loop to read
folder names, for each name you first check in record exists using
..FindFirst method, if not - then add folder using:


rst.AddNew
rst!FolderName= ...
rst.Update

I think it is even more easy then in Java <g>

--
Best regards,
___________
Alex Dybenko (MVP)
http://alexdyb.blogspot.com
http://www.PointLtd.com

"David M C" <(E-Mail Removed)> wrote in message
news:C9B4A100-5EF3-4E8C-9DD1-(E-Mail Removed)...
>I would like to append records to my Jobs table based on the name of
>folders
> in the K:\000Projects\GMJobsFile
>
> Each folder is of the format XXXX - Name where XXXX is the JobNumber and
> Name is the JobName
>
> My table structure for Jobs is:
>
> JobNumber - primary key number field
> JobName - text field
>
> The code will need to check to see if the job number already exists before
> adding it to the database. It will also have to parse the string into
> JobNumber and JobName. In Java this would be pretty simple. I'm sure it
> would
> be fairly simple in VB as well but could do with some help getting
> started.
>
> Thanks
>
> Dave
>
>


 
Reply With Quote
 
=?Utf-8?B?RGF2aWQgTSBD?=
Guest
Posts: n/a
 
      13th Apr 2006
Thanks, now I just need to work out how to parse the string. In Java I could
use a String Tokeniser or parse the string manually.

Thanks,

Dave

"Alex Dybenko" wrote:

> Hi,
> to get folder name - you can use Dir() function, access help has examples
> using it
>
> then you have to open recordset, based on your table, set a loop to read
> folder names, for each name you first check in record exists using
> ..FindFirst method, if not - then add folder using:
>
>
> rst.AddNew
> rst!FolderName= ...
> rst.Update
>
> I think it is even more easy then in Java <g>
>
> --
> Best regards,
> ___________
> Alex Dybenko (MVP)
> http://alexdyb.blogspot.com
> http://www.PointLtd.com
>
> "David M C" <(E-Mail Removed)> wrote in message
> news:C9B4A100-5EF3-4E8C-9DD1-(E-Mail Removed)...
> >I would like to append records to my Jobs table based on the name of
> >folders
> > in the K:\000Projects\GMJobsFile
> >
> > Each folder is of the format XXXX - Name where XXXX is the JobNumber and
> > Name is the JobName
> >
> > My table structure for Jobs is:
> >
> > JobNumber - primary key number field
> > JobName - text field
> >
> > The code will need to check to see if the job number already exists before
> > adding it to the database. It will also have to parse the string into
> > JobNumber and JobName. In Java this would be pretty simple. I'm sure it
> > would
> > be fairly simple in VB as well but could do with some help getting
> > started.
> >
> > Thanks
> >
> > Dave
> >
> >

>
>

 
Reply With Quote
 
John Nurick
Guest
Posts: n/a
 
      13th Apr 2006
If there's guaranteed only to be one " - " sequence in the name, I'd
probably split the string into an array on that:

JobNumber = Split(XXX, " - ")(0)
JobName = Split(XXX, " - ")(1)

If it's possible that there could be more than one " - ", I'd parse the
string manually using Instr(), Left() and Mid().




"David M C" <(E-Mail Removed)> wrote in message
news:AEDD8D63-3897-43DC-B3A4-(E-Mail Removed)...
> Thanks, now I just need to work out how to parse the string. In Java I
> could
> use a String Tokeniser or parse the string manually.
>
> Thanks,
>
> Dave
>
> "Alex Dybenko" wrote:
>
>> Hi,
>> to get folder name - you can use Dir() function, access help has
>> examples
>> using it
>>
>> then you have to open recordset, based on your table, set a loop to read
>> folder names, for each name you first check in record exists using
>> ..FindFirst method, if not - then add folder using:
>>
>>
>> rst.AddNew
>> rst!FolderName= ...
>> rst.Update
>>
>> I think it is even more easy then in Java <g>
>>
>> --
>> Best regards,
>> ___________
>> Alex Dybenko (MVP)
>> http://alexdyb.blogspot.com
>> http://www.PointLtd.com
>>
>> "David M C" <(E-Mail Removed)> wrote in message
>> news:C9B4A100-5EF3-4E8C-9DD1-(E-Mail Removed)...
>> >I would like to append records to my Jobs table based on the name of
>> >folders
>> > in the K:\000Projects\GMJobsFile
>> >
>> > Each folder is of the format XXXX - Name where XXXX is the JobNumber
>> > and
>> > Name is the JobName
>> >
>> > My table structure for Jobs is:
>> >
>> > JobNumber - primary key number field
>> > JobName - text field
>> >
>> > The code will need to check to see if the job number already exists
>> > before
>> > adding it to the database. It will also have to parse the string into
>> > JobNumber and JobName. In Java this would be pretty simple. I'm sure it
>> > would
>> > be fairly simple in VB as well but could do with some help getting
>> > started.
>> >
>> > Thanks
>> >
>> > Dave
>> >
>> >

>>
>>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
recursively retrieve records from 2nd table based on records from elsamiro2351 Microsoft Access Queries 1 9th Mar 2010 12:03 PM
Re: file names and folder names have been changed into some values automatically Malke Windows Vista File Management 0 11th Jul 2008 01:10 PM
Filtering records in a query based on field values in adjacent records sdisalvo Microsoft Access 2 27th May 2006 12:31 AM
Totally stupid question re: Project names and Folder names JoelBarish Microsoft Dot NET 0 30th Mar 2006 08:08 PM
Change names of files in a folder to match names in Excel Column saybut Microsoft Excel Programming 4 9th Feb 2004 06:26 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:20 PM.