B
Bill
The following (below) is the OnOpen code for form
frmRecipeDetails. The code functions as expected,
but with a slight twist. When the application is first
launched and frmRecipeDetails is opened for the
very first time, focus remains with frmRecipeDetails
instead of the application "Shelled". I.e., the "Shelled"
application opens as expected but the form window
has the focus. However, on ALL SUBSEQUENT
openings of frmRecipeDetails the focus is given to
the "Shelled" application as desired.
I can't figure out why the "Shelled" application isn't
getting the focus the first time the OnOpen code
for form frmRecipeDetails is opened. It only "fails"
if the first user action is to open frmRecipeDetails.
Any ideas?
Bill
==========(OnOpen)====================
Private Sub Form_Open(Cancel As Integer)
Dim intI As Integer ' General index variable
'Move to the record specified in open parameter
Me.RecordsetClone.FindFirst "[RecipeID] = " & Me.OpenArgs
Me.Bookmark = Me.RecordsetClone.Bookmark
intMajCatID = Me.cmboCategories.Column(0)
strImageFile = Replace(glbImageFiles, "#####", Right("00000" &
Me.RecipeID, 5))
strDocFile = Replace(glbDocFiles, "#####", Right("00000" & Me.RecipeID,
5))
If Len(Dir(strImageFile)) > 0 Then
Me.ImRecipeImage.Picture = strImageFile
Me.ImRecipeImage.Visible = True
End If
'===========================
' Reveal any sub-categories
'===========================
For intI = 1 To 4
If Me("subcat" & intI & "ID") > 1 Then
Call RevealSubCat(intI) ' Sub-category already
assigned
Else
Call RevealSubCat(intI) ' Open the door to
additional adds
Exit For
End If
Next
If Len(Dir(strDocFile)) > 0 Then ' Recipe in text or image?
strShell = glbDocEditor & " " & strDocFile
Else
strShell = "rundll32.exe shimgvw.dll,ImageView_Fullscreen " &
strImageFile
End If
lngShlRtn = Shell(strShell, vbMaximizedFocus) 'Either text or an image
End Sub
=====================================
frmRecipeDetails. The code functions as expected,
but with a slight twist. When the application is first
launched and frmRecipeDetails is opened for the
very first time, focus remains with frmRecipeDetails
instead of the application "Shelled". I.e., the "Shelled"
application opens as expected but the form window
has the focus. However, on ALL SUBSEQUENT
openings of frmRecipeDetails the focus is given to
the "Shelled" application as desired.
I can't figure out why the "Shelled" application isn't
getting the focus the first time the OnOpen code
for form frmRecipeDetails is opened. It only "fails"
if the first user action is to open frmRecipeDetails.
Any ideas?
Bill
==========(OnOpen)====================
Private Sub Form_Open(Cancel As Integer)
Dim intI As Integer ' General index variable
'Move to the record specified in open parameter
Me.RecordsetClone.FindFirst "[RecipeID] = " & Me.OpenArgs
Me.Bookmark = Me.RecordsetClone.Bookmark
intMajCatID = Me.cmboCategories.Column(0)
strImageFile = Replace(glbImageFiles, "#####", Right("00000" &
Me.RecipeID, 5))
strDocFile = Replace(glbDocFiles, "#####", Right("00000" & Me.RecipeID,
5))
If Len(Dir(strImageFile)) > 0 Then
Me.ImRecipeImage.Picture = strImageFile
Me.ImRecipeImage.Visible = True
End If
'===========================
' Reveal any sub-categories
'===========================
For intI = 1 To 4
If Me("subcat" & intI & "ID") > 1 Then
Call RevealSubCat(intI) ' Sub-category already
assigned
Else
Call RevealSubCat(intI) ' Open the door to
additional adds
Exit For
End If
Next
If Len(Dir(strDocFile)) > 0 Then ' Recipe in text or image?
strShell = glbDocEditor & " " & strDocFile
Else
strShell = "rundll32.exe shimgvw.dll,ImageView_Fullscreen " &
strImageFile
End If
lngShlRtn = Shell(strShell, vbMaximizedFocus) 'Either text or an image
End Sub
=====================================