Your first code is working, but the command is not exiting. The mouse curser just keeps spinning until I close the Data Base. The code now looks like the following
Code:
Option Compare Database
Option Explicit
Private Sub Form_Current()
If IsNull(Me![RecipeID]) Then
DoCmd.GoToControl "RecipeName"
End If
End Sub
Private Sub FoodCategoryID_NotInList(NewData As String, Response As Integer)
MsgBox "Double-click this field to add an entry to the list."
Response = acDataErrContinue
End Sub
Private Sub FoodCategoryID_DblClick(Cancel As Integer)
On Error GoTo Err_FoodCategoryID_DblClick
Dim lngCategoryID As Long
If IsNull(Me![FoodCategoryID]) Then
Me![FoodCategoryID].Text = ""
Else
lngCategoryID = Me![FoodCategoryID]
Me![FoodCategoryID] = Null
End If
DoCmd.OpenForm "Food Categories", , , , , acDialog, "GotoNew"
Me![FoodCategoryID].Requery
If lngCategoryID <> 0 Then Me![FoodCategoryID] = lngCategoryID
Exit_FoodCategoryID_DblClick:
Exit Sub
Err_FoodCategoryID_DblClick:
MsgBox Err.Description
Resume Exit_FoodCategoryID_DblClick
End Sub
Private Sub Multiply_Click()
Dim rst As Recordset
Dim dblFactor As Double
'On Error GoTo Multiply_Err
DoCmd.OpenForm "Multiply Dialog", , , , , acDialog
'If Not IsLoaded("Multiply Dialog") Then
'Exit Sub
'End If
If CurrentProject.AllForms("Multiply Dialog").IsLoaded Then
If IsNull(Forms![Multiply Dialog]![Factor]) Or Forms![Multiply Dialog]![Factor] = 0 Then
DoCmd.Close acForm, "Multiply Dialog"
Exit Sub
Else
DoCmd.Hourglass True
dblFactor = CDbl(Forms![Multiply Dialog]![Factor])
Set rst = Me![Recipes Subform].Form.RecordsetClone
rst.MoveFirst
While (Not (rst.EOF))
rst.Edit
rst![Quantity] = rst![Quantity] * dblFactor
rst.Update
rst.MoveNext
Wend
Me.SetFocus
Me![NumberofServings] = Forms![RECIPES]![NumberofServings] * dblFactor
rst.Close
End If
End If
End Sub