I am new to
VB and am using the Access 2002 VBA book (Beginning). There are several things that I have found very useful, but they do not go as far as I'd like. As a newbie, I am not sure if the following can be accomplished, but would love some suggestions. My questions are probably very basic, but I'll get better.
------
1) Chapter 2 - Pg. 85 contains the code to disable the previous button when the new record button is selected.
Private Sub Form_Current()
'Disables next button when form is on new Record
If Me.NewRecord = True Then
CmdPrevious.SetFocus
cmdNext.Enabled = False
Else
cmdNext.Enabled = True
End If
End Sub
The buttons on the buttons on the form include cmdNew, cmdFirst, cmdLast, cmdPrevious, cmdNext.
How can I disable the cmdPrevious button when the first record is selected, to avoid the error message if a user hits the previous button.
------
2) Chapter 5 Pgs. 189-192) uses a real nice routine that automatically adds any report written to the list box, so that you don't need to manually update a switchboard or add form buttons.
Private Sub Form_Load()
Dim objao As AccessObject
Dim objcp As Object
Dim strValues As String
Set objcp = Application.CurrentProject
ListReports.RowSourceType = "Value List"
For Each objao In objcp.AllReports
strValues = strValues & objao.Name & ";"
Me.ListReports.AddItem (objao.Name)
Next objao
ListReports.RowSource = strValues
End Sub
My questions are:
1) Some of the reports need to be run from specific forms/screens and generate an error message if they are run from this list.
Is there any way to hide or exclude specific reports form showing in the list box, while letting others be displayed?
2) The reports seems to change order/position between sessions.
Is there anyway to have them always appear in the list box in alphabetical order?
--------------------
Thanks in advance for any suggestions.
Brian