I have a form which, if an error condition is encountered, is to produce a MsgBox and open a subform giving further details. I want the subform to be positioned just below the message box. However I can't get my Form.Move method to work.
My code is below, the critical bits being in Bold:
In practice the subform opens but only at the top left of the screen. I have tried various variants - omitting the Forms. qualifier, changing the 1000,4000 measurements to Left:=1000, Top:=4000, making the subform mode acDSialog (this makes it worse: not only does the form not move, but because the subform is now modal the MsgBox doesn't even display) and depending on the variant I either get Error 438 (Object doesn't support this property or method) or Error 2465 (I think) or some other error, or it simply doesn't work.
Has anyone figured out how to make Form.Move work successfully?
My code is below, the critical bits being in Bold:
Code:
Private Sub Surname_AfterUpdate() ' Routine to check whether new person (or someone else with the same name) is already on file Dim Name_FnSn As String, Message As String, Response As Integer 'On Error GoTo ErrorHandler Name_FnSn = Me.First_name & " " & Me.Surname If DCount("[Name_FN-SN]", "People", "[Name_FN-SN]='" & Name_FnSn & "'") > 0 Then ' Person of this name is already on file. Display their address details so user can decide if it's the same person. [B] [B] DoCmd.OpenForm "subfrm_ContactInfo", acNormal, , "[Name_FN-SN]='" & Name_FnSn & "'", acFormReadOnly, acDialog[/B] [B] Forms.subfrm_ContactInfo.Move 1000, 4000[/B] [B]Message = "We already have a person named " & Name_FnSn & " on file. See details below. Is this the same person?"[/B] [B] Response = MsgBox(Message, vbYesNo + vbQuestion + vbDefaultButton2)[/B][/B] If Response = vbYes Then ' User says it is the same person as already on file Me.Undo ' So scrap the new entry, clean up and go home. DoCmd.Close acForm, "subfrm_ContactInfo", acSaveNo DoCmd.Close acForm, "Form_11: Enter new Applicant", acSaveNo GoTo ExitSub Else ' Not the same person, just someone with the same name, so clean up and carry on with the new record entry DoCmd.Close acForm, "subfrm_ContactInfo", acSaveNo End If Else ' We didn't find a duplicate, so we can carry on with the new record entry End If ExitSub: Exit Sub ErrorHandler: MsgBox "Error " & Err.Number & ": " & Err.Description End Sub
Has anyone figured out how to make Form.Move work successfully?
Comment