J
Jacco
This subject is abundant if typed in Google, but I keep getting a mistake,
I have created a Form Called "Edit Aircraft". I want this form to be opened
by another form. I inserted the Sample code found in the help-file:
Private Sub Form_Open(Cancel As Integer)
Dim intReturn As Integer
intReturn = MsgBox("Do you want to configure your aircraft now?",
vbYesNo)
Select Case intReturn
Case vbYes
' Open Order Details form.
DoCmd.OpenForm "Edit Aircraft"
Case vbNo
MsgBox "Remember to configure this aircraft at a later time"
Cancel = True ' Cancel Open event.
End Select
End Sub
This triggers a error when the form is being opened saying:
Procedure declaration does not match description event or procedure having
the same name.
I set the property for Form On Open [event procedure]
I don't understand what the problem is. I created a new Form "Form1" and
inserted the identical OnOpen event (with "Form1 offcourse", and it works as
advertised.
Anyone knows where the problem is?
Jacco
my complete code for "Edit Aircraft" is:
Option Compare Database
Private Sub Form_Open(Cancel As Integer)
Dim intReturn As Integer
intReturn = MsgBox("Enter order details now?", vbYesNo)
Select Case intReturn
Case vbYes
' Open Order Details form.
DoCmd.OpenForm "Edit Aircraft"
Case vbNo
MsgBox "Remember to enter order details by 5 P.M."
Cancel = True ' Cancel Open event.
End Select
End Sub
Private Sub List28_BeforeUpdate()
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[Type] = '" & Me![List28] & "'"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub
Private Sub List28_AfterUpdate()
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[Type] = '" & Me![List28] & "'"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub
Private Sub addnewaircraft_Click()
On Error GoTo Err_addnewaircraft_Click
DoCmd.GoToRecord , , acNewRec
Exit_addnewaircraft_Click:
Exit Sub
Err_addnewaircraft_Click:
MsgBox Err.Description
Resume Exit_addnewaircraft_Click
End Sub
Private Sub deletecurrentaircraft_Click()
On Error GoTo Err_deletecurrentaircraft_Click
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
Exit_deletecurrentaircraft_Click:
DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70
Exit Sub
Err_deletecurrentaircraft_Click:
MsgBox Err.Description
Resume Exit_deletecurrentaircraft_Click
End Sub
Private Sub refreshaircraft_Click()
On Error GoTo Err_refreshaircraft_Click
DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70
Exit_refreshaircraft_Click:
Exit Sub
Err_refreshaircraft_Click:
MsgBox Err.Description
Resume Exit_refreshaircraft_Click
End Sub
Private Sub undochanges_Click()
On Error GoTo Err_undochanges_Click
DoCmd.DoMenuItem acFormBar, acEditMenu, acUndo, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70
Exit_undochanges_Click:
Exit Sub
Err_undochanges_Click:
MsgBox Err.Description
Resume Exit_undochanges_Click
End Sub
I have created a Form Called "Edit Aircraft". I want this form to be opened
by another form. I inserted the Sample code found in the help-file:
Private Sub Form_Open(Cancel As Integer)
Dim intReturn As Integer
intReturn = MsgBox("Do you want to configure your aircraft now?",
vbYesNo)
Select Case intReturn
Case vbYes
' Open Order Details form.
DoCmd.OpenForm "Edit Aircraft"
Case vbNo
MsgBox "Remember to configure this aircraft at a later time"
Cancel = True ' Cancel Open event.
End Select
End Sub
This triggers a error when the form is being opened saying:
Procedure declaration does not match description event or procedure having
the same name.
I set the property for Form On Open [event procedure]
I don't understand what the problem is. I created a new Form "Form1" and
inserted the identical OnOpen event (with "Form1 offcourse", and it works as
advertised.
Anyone knows where the problem is?
Jacco
my complete code for "Edit Aircraft" is:
Option Compare Database
Private Sub Form_Open(Cancel As Integer)
Dim intReturn As Integer
intReturn = MsgBox("Enter order details now?", vbYesNo)
Select Case intReturn
Case vbYes
' Open Order Details form.
DoCmd.OpenForm "Edit Aircraft"
Case vbNo
MsgBox "Remember to enter order details by 5 P.M."
Cancel = True ' Cancel Open event.
End Select
End Sub
Private Sub List28_BeforeUpdate()
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[Type] = '" & Me![List28] & "'"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub
Private Sub List28_AfterUpdate()
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[Type] = '" & Me![List28] & "'"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub
Private Sub addnewaircraft_Click()
On Error GoTo Err_addnewaircraft_Click
DoCmd.GoToRecord , , acNewRec
Exit_addnewaircraft_Click:
Exit Sub
Err_addnewaircraft_Click:
MsgBox Err.Description
Resume Exit_addnewaircraft_Click
End Sub
Private Sub deletecurrentaircraft_Click()
On Error GoTo Err_deletecurrentaircraft_Click
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
Exit_deletecurrentaircraft_Click:
DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70
Exit Sub
Err_deletecurrentaircraft_Click:
MsgBox Err.Description
Resume Exit_deletecurrentaircraft_Click
End Sub
Private Sub refreshaircraft_Click()
On Error GoTo Err_refreshaircraft_Click
DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70
Exit_refreshaircraft_Click:
Exit Sub
Err_refreshaircraft_Click:
MsgBox Err.Description
Resume Exit_refreshaircraft_Click
End Sub
Private Sub undochanges_Click()
On Error GoTo Err_undochanges_Click
DoCmd.DoMenuItem acFormBar, acEditMenu, acUndo, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70
Exit_undochanges_Click:
Exit Sub
Err_undochanges_Click:
MsgBox Err.Description
Resume Exit_undochanges_Click
End Sub