What is the data type of the field MainData.cnum? The name
implies a numeric type, and you pass it a numeric value in
your SQL statement. But you have the number in single
quotes, and quotes are only for string values.
Code:
'you have this
Set rst = dbs.OpenRecordset("SELECT ips FROM MainData WHERE (MainData.cnum = '123456');")
'if MainData.cnum is a numeric field - single, double,
integer, etc. then you should have this
Set rst = dbs.OpenRecordset("SELECT ips FROM MainData WHERE (MainData.cnum = 123456);")