ob_ghosh
05-03-2002, 10:10 PM
i am currently doing a project in access which involves importing large amounts of text data. the data is in the format-
module code followed by module title followed by semester followed by credits
the module code is always 6 alphanumeric charechters, the module title varies for different modules - it is completely inconsistent and may be 1 word or upto ten words, the semester is either 'A' 'S' or 'B', and the credits are between 0-120 in multiples of 5.
the problem with the data is that there are no seperators, the data is seperated by spaces, however the module title may also contain spaces within it.
it is easy enough to seperate the module title from the other details, however after this i find it very diifficult to seperate the remaining module details.
Our professor has suggested using calculated fields with an expression builder
iff(mid(details),len(details)-1,1)=" ",1,iif(mid(details),len(details)-2,1)=" ",2,3)
where details is the field containing the module details
Now what i understand from this expression is it will calculate the length of the field and minus one from it, if the charechter in this position is a [space] it will be identified by a 1, this will occur in the case of single digit credit modules (ie 0,5 credit modules)
if the charechter is not a space it will go further into the string and if the next digit from the right is a space it will return the value 2,this is for all the two digit credit modules. and finally it will return a three for all other results ( ie the three digit credit modules). in this way we will have numeric identifiers for the last space, and therefore ccess will be able to use the last space to sort the data, all data after the last space is credits, and the data immediatley preceeding the last space is semester.
once we hae the position of the last space in numeric terms it is possible to extract the data using the right and id operators.
however just trying to set up the expression i consistently come up with syntax errors or access simply crashes. could you please tell me how to proceed with this . if you like i can mail you the text file containing the data.
in desperate need of help.thanx a lot
avik
module code followed by module title followed by semester followed by credits
the module code is always 6 alphanumeric charechters, the module title varies for different modules - it is completely inconsistent and may be 1 word or upto ten words, the semester is either 'A' 'S' or 'B', and the credits are between 0-120 in multiples of 5.
the problem with the data is that there are no seperators, the data is seperated by spaces, however the module title may also contain spaces within it.
it is easy enough to seperate the module title from the other details, however after this i find it very diifficult to seperate the remaining module details.
Our professor has suggested using calculated fields with an expression builder
iff(mid(details),len(details)-1,1)=" ",1,iif(mid(details),len(details)-2,1)=" ",2,3)
where details is the field containing the module details
Now what i understand from this expression is it will calculate the length of the field and minus one from it, if the charechter in this position is a [space] it will be identified by a 1, this will occur in the case of single digit credit modules (ie 0,5 credit modules)
if the charechter is not a space it will go further into the string and if the next digit from the right is a space it will return the value 2,this is for all the two digit credit modules. and finally it will return a three for all other results ( ie the three digit credit modules). in this way we will have numeric identifiers for the last space, and therefore ccess will be able to use the last space to sort the data, all data after the last space is credits, and the data immediatley preceeding the last space is semester.
once we hae the position of the last space in numeric terms it is possible to extract the data using the right and id operators.
however just trying to set up the expression i consistently come up with syntax errors or access simply crashes. could you please tell me how to proceed with this . if you like i can mail you the text file containing the data.
in desperate need of help.thanx a lot
avik