Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Macros / November 2004

Tip: Looking for answers? Try searching our database.

Re-Post - DoCmd.OpenForm Modality Problem - Form's Modal = "Yes"

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
GaryZ - 26 Nov 2004 14:51 GMT
The The form called by DoCmd.OpenForm should wait for a user to input proper
Utility Names, but doesn't. The form appears, but immediately the MsgBox
prompt appears on top of the form. The prompt has focus. This prompt should
not appear until the user leaves the other form.

The form's Modal is "Yes". Allow Edits is "Yes"

Here is the entire procedure:

Private Sub CmdUpdUtilFld_Click()
   ' Create adodb recordset, connection and command here
   Dim rs As ADODB.Recordset
   Dim cnn As ADODB.Connection
   Dim cmd As ADODB.Command
   
   ' Try the following adodb connection
   Set cnn = CurrentProject.Connection
   Set cmd = New ADODB.Command
   With cmd
       .ActiveConnection = cnn
       ' Select Distinct Utility Field to create table Old-NewUtil
containing fields OldUtility and NewUtility
       .CommandText = "SELECT DISTINCT [Utility] AS OldUtility, Space(60)
AS NewUtility INTO [Old-NewUtil] FROM [QA Follow-Up]"
       .Execute
   End With
   Set cmd = Nothing
   Set cnn = Nothing

'--- Here is the problem source code
'--- This form has two columns. 1. A list of Utility Names, 2. An empty
field for entering the proper Utility Name. These are the fields from
"Old-NewUtil" created in the above SQL.
   'Open "Input New Utility Names" form in datasheet view and Edit mode in
order to input proper values into NewUtility field.
   DoCmd.OpenForm "Input New Utility Names", acFormDS, , , acFormEdit

   ' Prompt to Update QA Follow-Up
   Dim Prompt As String, Title As String, Response As Variant
   Title = "Preparing to Update QA Follow-Up"
   Prompt = "Do you want to Update the QA Follow-Up.Utility Field?"
'--- This MsgBox appears immediately on top of the displayed form. The
MsgBox has focus.
   Response = MsgBox(Prompt, vbInformation + vbYesNo, Title)
   If Response = vbNo Then
        Exit Sub
   End If
   
   Set cnn = CurrentProject.Connection
   Set cmd = New ADODB.Command
   With cmd
       'Update QA Follow-Up.Utility Field with new value
       .CommandText = "UPDATE [QA Follow-Up] INNER JOIN [Old-NewUtil] ON
[QA Follow-Up].[Utility]=[Old-NewUtil].[oldUtility] SET [QA
Follow-Up].Utility = [Old-NewUtil].[NEWUtility];"
       .Execute
   End With
   Set cmd = Nothing
   Set cnn = Nothing
   
End Sub
Steve Schapel - 27 Nov 2004 04:25 GMT
Gary,

As far as I can tell, the code is doing exactly what I would expect.

Do you mean that you want the [Input New Utility Names] form to be
opened, and then, after the user has entered some data into this form,
for the Message Box to prompt at that point for confirmation to run the
Update?  If so, it seems to me that the code should be on an event,
maybe the After Update, of the applicable control on the [Input New
Utility Names] form, or the After Update event of the form itself.

Your question does not relate to macros, which is the focus of this
forum.  If the above suggestion doesn't help, maybe a post to the
microsoft.public.access.adp or microsoft.public.access.formscoding
newsgroups might yield a better response.

Signature

Steve Schapel, Microsoft Access MVP

> The The form called by DoCmd.OpenForm should wait for a user to input proper
> Utility Names, but doesn't. The form appears, but immediately the MsgBox
[quoted text clipped - 57 lines]
>    
> End Sub
GaryZ - 29 Nov 2004 14:11 GMT
Thanks Steve,

> a post to the microsoft.public.access.adp or microsoft.public.access.formscoding
> newsgroups might yield a better response.

Just did so in microsoft.public.Access.FormsCoding. Could not find
microsoft.public.Access.ADP or microsoft.public.Access.ADO.

Also worded the question better. MsgBox should not appear until after user
closes the form via the X button. Instead MsgBox appears and gets focus
immediatly after the form is opened. As if the DoCmd.OpenForm displays the
form, but doesn't gain focus.

Thanks anyway.
Gijs Beukenoot - 29 Nov 2004 14:23 GMT
GaryZ had uiteengezet :
> Thanks Steve,
>
[quoted text clipped - 11 lines]
>
> Thanks anyway.

See answer in microsoft.public.Access.FormsCoding

Signature

Your eyes are weary from staring at the CRT. You feel sleepy. Notice
how restful it is to watch the cursor blink. Close your eyes. The
opinions stated above are yours. When I snap my fingers, you cannot
imagine why you ever felt otherwise. <snap

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.