option explicit
public sub move_size_design_view()
dim ac as access.application
dim db as dao.database
dim mdb_file_name As String
mdb_file_name = "c:\temp\move_size_design_view_test.mdb"
deleteIfExists (mdb_file_name)
set ac = new access.application
set db = ac.dbEngine.workspaces(0).createDatabase(mdb_file_name, dbLangGeneral, 0)
ac.openCurrentDatabase(mdb_file_name)
dim fm as access.form
set fm = create_form(ac, "Someform", 20, 40, 200, 600)
end sub
private function create_form(ac as access.application, frm_name as string, x as long, y as long, w as long, h as long) as access.form
dim fm as access.form
set fm = ac.createForm()
' Giving the form a name:
dim form_name_orig as string
form_name_orig = fm.name
doCmd.openForm fm.name, acDesign
doCmd.moveSize x*15 , y*15 , w*15, h*15
ac.doCmd.close acForm, form_name_orig, acSaveYes
ac.doCmd.rename frm_name, acForm, form_name_orig
end function
private sub deleteIfExists(fileToDelete As String)
' Extras->Verweise
' Check "Microsoft Scripting Runtime"
'
dim fso As New FileSystemObject
dim aFile As file
if (fso.FileExists(fileToDelete)) then
Set aFile = fso.GetFile(fileToDelete)
aFile.Delete
end if
end sub