Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here


Microsoft: Access Modules (VBA Coding) FAQ


Writeing to the RegBase and control your windows by hermanlaksko
Posted: 2 Sep 02

The window position thing only works in A-XP, but the below shows you how to write to and read from the registration database.

1. On form open event insert:
FormRegGet Me.Name

2. On Form close event insert:
FormRegSet Me.Name

Function FormRegSet(MyForm)
On Error Resume Next
Dim Frm As Form
Dim FTop, FLeft, FTopOld
Set Frm = Forms(MyForm)
FTop = 0: FLeft = 0: FTopOld = 0
FTop = Frm.WindowTop
FLeft = Frm.WindowLeft
FTopOld = GetSetting("YourApp", "FormsPosition", MyForm & "T")
If FTop - FTopOld = 345 Then FTop = FTop - 345 'Menulinie chk

SaveSetting "YourApp", "FormsPosition", MyForm & "T", FTop
SaveSetting "YourApp", "FormsPosition", MyForm & "L", FLeft
End Function

Function FormRegGet(MyForm As String)
Dim FLeft, FTop
Dim Frm As Form
Set Frm = Forms(MyForm)

FTop = GetSetting("YourApp", "FormsPosition", MyForm & "T") ' - 345 '= menulinie
FLeft = GetSetting("YourApp", "FormsPosition", MyForm & "L")
If Not IsBlank(FTop) And Not IsBlank(FLeft) Then DoCmd.MoveSize FLeft, FTop
End Function

I have used "T" for TopPosition of the window and "L" for left position.
You will find your inserted information in the regbase under HKey_Current_User/Software/VB and VBA Program Settings/YourApp.
Have fun

Back to Microsoft: Access Modules (VBA Coding) FAQ Index
Back to Microsoft: Access Modules (VBA Coding) Forum

My Archive

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close