Sometimes you have to learn a new technique. DB does not allow for mangled variable names. You have to use an array of integers or an array of types with an integer inside it to store your object IDs.
For example:
rem some code to load building1.x to building10.x
dim buildings(10) as integer
for a = 1 to 10
rem let's assign IDs 101 to 110 to buildings
buildings(a) = 100 + a
rem let's assume sequential file names for the objects
fn = "building"+str$(a)+".x"
load object fn, buildings(a)
next a
rem doing something 'useful' to the buildings like random placement
for a = 1 to 10
position object buildings(a), rnd(100)-50, 0, rnd(100)-50
next a