Quote:

- what am I doing wrong?



As Les says, USE is a command. Commands do not return anything, but they do set the @ERROR macro. Because they do not return anything thay cannot be used in an expression. The IF construct is expecting an expression.

Functions do return a value (and set @ERROR) so can be used in a conditional construct such as IF and WHILE.

In this case you need to write your code as:
Code:
USE X: \\server\share
If @ERROR
"ERROR" ?
Else
"SUCCESS" ?
EndIf



Quote:

- is there a reason to specify a variable with the small caption first ($sPrinter) ?



It is good programming practice to make your variable names reflect their use. This is known as "Hungarian Notation". In this case we use a simplified style "Short Form Hungarian Notation", and the "s" just means that the variable will contain string values. It's not so important in KiXtart as variables are not declared with a type, but it does help to keep your code easy to read and debug. Search the web if you want to know more about Hungarian Notation.

Quote:

- why isn't there a argument after "If USE $nDrive +$nUse




IF takes an expression which must evaluate to true or false. In the case of USE it won't work because USE does not return a value.

For something like WriteValue() which does return a value you can check it in an expression. It will return a zero value when there is no error, or an error code when there is an error.

This means that these two statements are exactly the same:
Code:
If WriteValue(a,b,c)
"ERROR" ?
EndIf
... and ...
If WriteValue(a,b,c) <> 0
"ERROR" ?
EndIf



You can reverse the test using Not, so
Code:
If WriteValue(a,b,c)=0
"SUCCESS" ?
EndIf
... is the same as ...
If Not WriteValue(a,b,c)
"SUCCESS" ?
EndIf