Advertisement

06.18.2008 at 04:04AM PDT, ID: 23494692
[x]
Attachment Details

How to exit an attempted change to a radio button via a MsgBox and backout of the change if the user changes their mind ?

Asked by zimmer9 in Microsoft ADP, Access Forms, Access Coding/Macros

I am creating an Access 2003 application using Access as the front end and SQL Server as the back end database.

How would you change the following routines to cancel a user action to change the value of a radio button within a frame, if the user changes their mind by selecting No from a MsgBox ?

Perhaps the following could be asked via a MsgBox once the user attempts to change the radio button value:
---------------------------------------------------------------
Are you sure you want to change the Reporting cycle between Fall and Spring ?  Yes No
If No, then exit the subroutine and bypass any updates.
If Yes, then process the change via the subroutines.Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
Private Sub Frame380_Click()
Dim str_sql1 As String
    If Me.Frame380.Value = 1 Then
       Label478.Caption = "Fall"
       Label612.Caption = "Fall"
       Label616.Caption = "Fall"
       Label617.Caption = "Fall"
       str_sql1 = "Update tblCycle Set Fall = 1"
       DoCmd.RunSQL (str_sql1)
    Else
       Label478.Caption = "Spring"
       Label612.Caption = "Spring"
       Label616.Caption = "Spring"
       Label617.Caption = "Spring"
       str_sql1 = "Update tblCycle Set Fall = 2"
       DoCmd.RunSQL (str_sql1)
    End If 
End Sub
-----------------------------------
Private Sub Frame380_AfterUpdate()
    Dim str_sql As String
    Dim str_ToFall As String
    Dim str_ToSpring As String
    Dim tname As String
    
    Set cn = New ADODB.Recordset
    
    str_ToFall = "From Spring To Fall"
    str_ToSpring = "From Fall To Spring"
    
    cn.ActiveConnection = CurrentProject.Connection
    cn.CursorType = adOpenStatic
    cn.CursorLocation = adUseServer
    cn.LockType = adLockReadOnly
    
    DoCmd.Hourglass True
          
    dteToday = Format(Now(), "mm/dd/yyyy")
    strUserName = fOSUserName
           
    Dim str_sql1 As String
    Me.cmbOffice = " "
    Me.cmbCustomer = " "
    DeleteACSE
    Me.cmbOffice.Requery
    Me.cmbCustomer.Requery
     
    If Me.Frame380.Value = 1 Then
       str_sql = "INSERT INTO tblCycleUpdate values ('" & strUserName & "', getdate(),'" & str_ToFall & "')"
       DoCmd.RunSQL (str_sql)
                       
       tname = "tblBranchFallExcl" & Format(Date, "yymmdd")
       CurrentProject.Connection.Execute "IF OBJECT_ID('" & tname & "') IS NOT NULL DROP TABLE " & tname
                       
       str_sql = "Select * INTO dbo.tblBranchFallExcl" & Format(Date, "yymmdd") & "  FROM tblBranchFallExcl"
       DoCmd.RunSQL (str_sql)
       
       str_sql = "If  Exists(SELECT * FROM dbo.SYSOBJECTS WHERE NAME = 'tblBranchFallExcl' AND TYPE = 'U')  DELETE FROM tblBranchFallExcl"
       DoCmd.RunSQL (str_sql)
       
       lstBranchAll.RowSource = "Select Distinct Left([CPS Account Number],3) from tblFLLNExp where  Left([CPS Account Number],3)  not in (select branch from tblBranchFallExcl) order by Left([CPS Account Number],3)"
       lstBranchExcl.RowSource = "Select Distinct Branch from tblBranchFallExcl order by Branch"
       lstBranchAll.Requery
       lstBranchExcl.Requery
    Else
       str_sql = "INSERT INTO tblCycleUpdate values ('" & strUserName & "', getdate(),'" & str_ToSpring & "')"
       DoCmd.RunSQL (str_sql)
        
       tname = "tblBranchSpringExcl" & Format(Date, "yymmdd")
       CurrentProject.Connection.Execute "IF OBJECT_ID('" & tname & "') IS NOT NULL DROP TABLE " & tname
        
       str_sql = "Select * INTO dbo.tblBranchSpringExcl" & Format(Date, "yymmdd") & "  FROM tblBranchSpringExcl"
       DoCmd.RunSQL (str_sql)
    
       str_sql = "If  Exists(SELECT * FROM dbo.SYSOBJECTS WHERE NAME = 'tblBranchSpringExcl' AND TYPE = 'U')  DELETE FROM tblBranchSpringExcl"
       DoCmd.RunSQL (str_sql)
     
       lstBranchAll.RowSource = "Select Distinct Left([CPS Account Number],3) from tblSpLNExp where  Left([CPS Account Number],3)  not in (select branch from tblBranchSpringExcl) order by Left([CPS Account Number],3)"
       lstBranchExcl.RowSource = "Select Distinct Branch from tblBranchSpringExcl order by Branch"
       lstBranchAll.Requery
       lstBranchExcl.Requery
    End If     
End Sub
[+][-]06.18.2008 at 05:05AM PDT, ID: 21811942

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.18.2008 at 05:50AM PDT, ID: 21812237

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.18.2008 at 06:09AM PDT, ID: 21812404

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.18.2008 at 06:10AM PDT, ID: 21812414

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.18.2008 at 06:24AM PDT, ID: 21812546

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.18.2008 at 06:28AM PDT, ID: 21812592

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.18.2008 at 06:37AM PDT, ID: 21812678

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Microsoft ADP, Access Forms, Access Coding/Macros
Sign Up Now!
Solution Provided By: vadimrapp1
Participating Experts: 3
Solution Grade: A
 
 
[+][-]06.18.2008 at 06:44AM PDT, ID: 21812757

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.18.2008 at 07:06AM PDT, ID: 21812998

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.18.2008 at 07:57AM PDT, ID: 21813583

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628