BeardedSith
Member
- Local time
- Today, 09:51
- Joined
- Feb 5, 2020
- Messages
- 73
I have a procedure I created (let's be real, it's stupid simple...) and call each time a form is loaded. But I'm having an issue with one specific form and getting it to work correctly.
Here's the procedure:
I just "Call FormStartUp()" with each On Load Event in the database. It works great for every form except one.
The form in question in my "main" data entry form. There are others, but most everything in the database revolves around this one form.
Here's the On Load:
So I've moved "Call FormStartUp" around within the procedure, but each time I get a different issue popping up. If I leave it where it is (albeit uncommented), I get an error that states "The command or actions 'GoToRecord' isn't available now". When the form opens, the object browser is still showing or reappears. If I move the line lower, past the OpenArgs block, I don't get the error, but it also makes the Object Browser reappear. When it's commented out (like it is in the snippet above), nothing happens and the object browser reappears when you open the form. This procedure works for every other form in the database, but for some reason not this one. It appears as though the OpenArgs block might be interfering with the procedure, but I have no clue how or why.
Ideas? I tried leaving it out and just using it on my other forms, but when the database opens this form, no matter what, it shows the object browser.
Here's the procedure:
Code:
Public Function FormStartUp()
DoCmd.SelectObject acTable, , True
DoCmd.RunCommand (acCmdWindowHide)
End Function
I just "Call FormStartUp()" with each On Load Event in the database. It works great for every form except one.
The form in question in my "main" data entry form. There are others, but most everything in the database revolves around this one form.
Here's the On Load:
Code:
Private Sub Form_Load()
On Error GoTo Form_Load_Err
'Call FormStartUp
FilterList
Call IssueRewards
Dim CusID, rst As Recordset
CusID = Nz(Me.OpenArgs, 0)
If CusID > 0 Then
Set rst = Me.RecordsetClone
rst.FindFirst "ID = " & CusID
If Not rst.NoMatch Then
Me.Bookmark = rst.Bookmark
End If
rst.Close
Else
DoCmd.GoToRecord acDataForm, Me.Name, acNewRec
End If
Form_Load_Exit:
Exit Sub
Form_Load_Err:
MsgBox Error$
Resume Form_Load_Exit
End Sub
So I've moved "Call FormStartUp" around within the procedure, but each time I get a different issue popping up. If I leave it where it is (albeit uncommented), I get an error that states "The command or actions 'GoToRecord' isn't available now". When the form opens, the object browser is still showing or reappears. If I move the line lower, past the OpenArgs block, I don't get the error, but it also makes the Object Browser reappear. When it's commented out (like it is in the snippet above), nothing happens and the object browser reappears when you open the form. This procedure works for every other form in the database, but for some reason not this one. It appears as though the OpenArgs block might be interfering with the procedure, but I have no clue how or why.
Ideas? I tried leaving it out and just using it on my other forms, but when the database opens this form, no matter what, it shows the object browser.