-
I am using an access database with my program, i emailed my program to a friend yesterday to see if it would run on his computer, like me he has the professional edition. The program ran fine on his computer, although the forms weren't centered due to the resolution. My problem was I put the program on a CD took it home and loaded it in my computer at home, which also has the professional edition and it wouldn't work. I got an error saying(sorry don't remember exact words)that it couldn't access the database, that it was read only, and that the the programmer set it's administrative settings that way and they would need to be changed. Any ideas why it worked on my friends computer, but not mine? And any ideas what to do about the settings? And while we at it, could someone go over once again the code to set the child forms to open centered in the MDI parent, regardless of resolution settings?
Thanks!
-
centering forms
Cady,
Not sure about all your access problems but i can help with the mdi problem.
when the child form loads put the following into the form load event
Me.Move (mdiForm1.Width - Me.Width) / 2, (mdiForm1.Height - Me.Height) / 2, Me.Width, Me.Height
Hope this solves at least your easier problem
Iain.
-
If you have a toolbar in your mdi form then the child form will not be centered vertically, try this :
Me.Left = mdiForm1.ScaleWidth - Me.Width) / 2
Me.Top = mdiForm1.ScaleHeight - Me.Height) / 2
Just a thought but have you checked the properties of the access db to see if it read only.
-
That should of course be with the ('s before the mdiForm1's. :)
-
Thanks, I tried both of your codes and with both the form opened in the upper left hand corner, not all the way but pretty close. Anymore thoughts on this?
Stevie, this is a stupid question that I think I know the answer to but don't want to screw anything up, but how do I check if I have it set to read only?
Thanks again.
-
Hi, Cady.
Setting Child Form Size and Position
When an MDI child form has a sizable border (BorderStyle = 2), Microsoft Windows determines its initial height, width, and position when it is loaded. The initial size and position of a child form with a sizable border depends on the size of the MDI form, not on the size of the child form at design time. When an MDI child form's border is not sizable (BorderStyle = 0, 1, or 3), it is loaded using its design-time Height and Width properties.
If you set AutoShowChildren to False, you can change the position of the MDI child after you load it, but before you make it visible.
Private Sub MDIForm_Load()
MDIForm1.AutoShowChildren = False
Form1.Move (MDIForm1.Width - Form1.Width) / 2, (MDIForm1.Height - Form1.Height) / 2, Form1.Width, Form1.Height
MDIForm1.AutoShowChildren = True
End Sub
Private Sub MDIForm_Resize()
Form1.Move (MDIForm1.Width - Form1.Width) / 2, (MDIForm1.Height - Form1.Height) / 2, Form1.Width, Form1.Height
End Sub
Larisa
-
Just right click on the mdb file from windows explorer, and the file attributes will be displayed. If the read only check box is ticked, just uncheck it to make it no longer read only.
Also I forgot to mention that for my code to work I had the border style of the child window set to fixed single.
Hope this helps. :)
-
when you download a file (or copy) from a CD,
the file attribute of the file would be "read only".
you can change this via the explorer or if
you downloaded so many files, make a vb program
that changes the file attributes of the files
(surely you have heard of the "SetAttr" statement
in vb, haven't you?)
hope this could be of help...:):):)