I have decided that it is something to do with the server it is run on, as the code works fine on a different server. But here it is, to see if there are any obvious errors.
It is safe to assume that the recordsets are returning the correct values, and that incoming variables are correct as I have checked them a million times!
This is a seperate file which is included in another ASP file
'Function to create actual directory
'Author: C.Kenworthy
'Date: 11/03/03
Dim varclient_id
varclient_id = Request.QueryString("client_id"
Dim varFullPath, varNewDirName, varCompany
'Declare recordsets
Dim dir
Dim dir_numRows
'Get choice of dir name from radio group
varNewDirName = Request.Form("dirname"
if varNewDirName = "other_specified_value" then
varNewDirName = Request.Form("txtother"

end if
if Session("current_location"

= "Add a client" then
'If adding a client set default root directory and new client directory name
varFullPath = "\\PDC01\client_docs\" & varNewDirName & "\"
'Update client table with folder directory
set clientdir = Server.CreateObject("ADODB.Command"

clientdir.ActiveConnection = MM_client_projects_STRING
clientdir.CommandText = "UPDATE dbo.client SET shared_folder = '" & varfullpath & "' WHERE client_id = '" & varclient_id & "'"
clientdir.CommandType = 1
clientdir.CommandTimeout = 0
clientdir.Prepared = true
clientdir.Execute()
'Get company name for log
Set dir = Server.CreateObject("ADODB.Recordset"

dir.ActiveConnection = MM_client_projects_STRING
dir.Source = "SELECT company FROM dbo.client WHERE client_id = '" & varclient_id & "'"
dir.CursorType = 0
dir.CursorLocation = 2
dir.LockType = 1
dir.Open()
dir_numRows = 0
varCompany = dir("company"
dir.Close()
Set dir = Nothing
elseif Session("current_location"

= "Add a client project" then
'If adding a project, retrieve root directory of client and append client project directory
'Get root directory and company name aswell for log
Set dir = Server.CreateObject("ADODB.Recordset"

dir.ActiveConnection = MM_client_projects_STRING
dir.Source = "SELECT company, shared_folder FROM dbo.client WHERE client_id = '" & varclient_id & "'"
dir.CursorType = 0
dir.CursorLocation = 2
dir.LockType = 1
dir.Open()
dir_numRows = 0
varFullPath = dir("shared_folder"

& varNewDirName & "\"
varCompany = dir("company"
dir.Close()
Set dir = Nothing
'Update shared folder of project
set projdir = Server.CreateObject("ADODB.Command"

projdir.ActiveConnection = MM_client_projects_STRING
projdir.CommandText = "UPDATE dbo.project SET shared_folder = '" & varfullpath & "' WHERE client_id = '" & varclient_id & "'"
projdir.CommandType = 1
projdir.CommandTimeout = 0
projdir.Prepared = true
projdir.Execute()
end if
'Create the shared directory
Dim objFS, objDirectory
set objFS = Server.CreateObject("Scripting.FileSystemObject"
Dim FolderDoesExist
FolderDoesExist = "0"
'Check if directory already exists
if objFS.FolderExists(varFullPath) = "True" then
'Do not create directory, raise flag to indicate error
FolderDoesExist = "1"
else
'Create directory if it doesn't already exist
'Cut off the \ at the end of the directory name
Dim strLength, strTrimDirname
strLength = Len(varFullPath)
strTrimDirname = Left(varFullPath, strLength-1)
set objDirectory = objFS.CreateFolder(strTrimDirname)
set objDirectory = nothing
'Append to activity log
Dim Filename
set Filename = objFS.OpenTextFile(Server.MapPath("../logs/activity.txt"

, 8, true)
Filename.WriteLine(Date & " " & Time & " - Directory CREATED: " & varFullPath)
'Add line depending on operation
if Session("current_location"

= "Add a client" then
Filename.WriteLine("This CLIENT directory was created for client: '" & varCompany & "'"
elseif Session("current_location"

= "Add a client project" then
Filename.WriteLine("This PROJECT directory was created for client: '" & varCompany & "'"
end if
Filename.Close
set Filename = nothing
set objFS = nothing
end if