View Full Version : Open form with record selectors on or off.


BukHix
11-20-2001, 05:14 AM
I know I am missing something obvious here but how do you turn record selectors on from code. I have a form that will be used for adding records 90% of the time. By default it is set to Add Records with no record selector.

I have a switchboard to open the form in Add or Edit mode but I am having problems getting the record selectors turned on in the form. Any ideas?

DoCmd.OpenForm "CloseOutForm", , , , acFormEdit
Forms!closeoutform.RecordSelectors = True

[This message has been edited by BukHix (edited 11-20-2001).]

Fornatian
11-20-2001, 07:35 AM
Bux,

I tried this and it worked in the OnOpen event of the form.

Me.RecordSelectors = Confirm("SHOW RECORD SELECTORS?")

and had a public function Confirm as follows

Public Const conAppName = "Export Documentation Central"

Public Function Confirm(StrMessage As String) As Boolean
Dim BytChoice As Byte
BytChoice = MsgBox(StrMessage, vbQuestion + vbYesNo + vbDefaultButton2, conAppName)
If BytChoice = vbYes Then
Confirm = True
Else
Confirm = False
End If
End Function

You should be able to set a global boolean variable should you wish. Additionally I've just tried it with a button wizard variation and that worked, the code went like this:

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Football"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Forms(stDocName).RecordSelectors = True

I've looked at your code and it looks fine.

Ian

BukHix
11-20-2001, 08:34 AM
Thanks Fornatian,

Part of my problem is that I was trying to set record selectors to true when I needed navigation buttons set to true also.


Dim stDocName As String

stDocName = "closeoutform"

DoCmd.OpenForm "CloseOutForm", , , , acFormEdit
Forms(stDocName).RecordSelectors = True
Forms(stDocName).NavigationButtons = True
Forms(stDocName).cmdaddnew.enabled = False