handle

scoob8254

Registered User.
Local time
Today, 10:56
Joined
Mar 2, 2008
Messages
76
hello

got a bit of code here that keeps erroring out and not sure how to resolve my problem, basicaly ive got some code that runs through all the log files ina dir and strips out any id, alias and chat data in them, and stores them in a way that can be cross referenced later,

prob is theirs no restrictions on alias's ie what characters they may contain, and am unable to change this. my code falls over it seems as soon as it hits a player with a certain alias, his alias contains the char '

for example jimmy'

he must think its cool it being their, anyway i believe its this that screws up my code. need some way of handling this, and characters that screw up insert into

incase its needed my code that gets the alias

'get player alias
sNick = sData
sNick = Mid([sNick], 5, InStrRev([sNick], "<", InStrRev([sNick], "<", InStrRev([sNick], "<") - 1) - 1) - 4)
sNick = Mid(sNick, 23, ((Len(sNick) - 23)))

code that inputs it into table

'insert nick
mySQL = "INSERT INTO tblAlias ( UserID, Alias)"
mySQL = mySQL + " VALUES ( '" & sID & "', '" & sNick & "')"
DoCmd.RunSQL mySQL


any help appreciated
 
Try

mySQL = mySQL + " VALUES ( '" & sID & "', " & Chr$(34) & sNick & Chr$(34) & ")"
 
worked a treat but now my dlookup errors out

'check if alias used before if not insert
Counter = DCount("[Alias]", "[tblAlias]", "[Alias]='" & sNick & "' And [UserID]=" & sID & "")
If Counter = 0 Then
mySQL = "INSERT INTO tblAlias ( UserID, Alias)"
mySQL = mySQL + " VALUES ( '" & sID & "', '" & sNick & "')"
DoCmd.RunSQL mySQL


grrrrrr

maybe just removing the offending characters might be better, dont know

cheers anyway
 
The same technique should work in the DCount.
 
thanks for all ya help m8

, tried applying same method to an insert into later in the code and to the dlookup,both getting syntax error's

the insert into is "syntax error missing operator", and the dlookup is "syntax error in string in query expression"

believe they being caused because of sNick holding an alias like AAA# BBBBBBB '
some reason hes got space then ' at the end

again thanks
scoobs
 
tbh scrap that, getting somewhere me think will post later :)
scoobs
 

Users who are viewing this thread

Back
Top Bottom