PDA

View Full Version : Format Function Error - Expected Array



mongoose
11-04-2019, 08:57 AM
I keep getting an error when I try to format this number. I've done it in VBA before and I tried to change the SOPID to a variant, a string, and an integer.



Dim SOPID As Integer
SOPID = DMax("file_id", "tblSOP") + 1

'Output test data
MsgBox (format(SOPID, "000"))


I have no idea what I am doing wrong.

OBP
11-05-2019, 02:05 AM
This works for me
Dim x As Integer
x = 11
MsgBox Format(x, "0000")

I get 0011

Which suggests that the outer brackets you used force Access to expect a function outside them.