Is the rs.open line correct?
No. The rest of the routine has problems too. I will assume that Conn refers to a connection object that already exists.
cmd = "SELECT MAX(orderID) AS LastID FROM itemsOrdered
set rs = Server.CreateObject("ADODB.Connection")
rs.open Cmd, Conn, adOpenDynamic, adLockOptimistic, adCmdText
GetNextOrderID = VAL(0 & rs("LastID")) + 1