vba codes
2 TopicsVBA - Option Button MSAccess
Dear All, I am using the For Each...Next loop below to check whether an option button in an MS Access form is selected. Private Sub cmdOK_Click() Dim Ctl As Control DoCmd.SetWarnings False For Each Ctl In Me.Controls If Ctl.ControlType = acOptionButton And Ctl.Value = True Then Select Case Ctl.Name Case "optRegionA" If PL_Availability("REGION") = "Y" Then MsgBox "REGION Pricelist has been generated successfully!", vbInformation Else MsgBox "REGION Pricelist has been disabled!", vbCritical End If End Select End If Next Ctl DoCmd.SetWarnings True End Sub However, I am encountering the error shown below. The issue seems to be caused by this line: And Ctl.Value = True Could you please help me resolve this? Thanks36Views0likes0CommentsUpdating a field in a Form 1 using button in Form 2
Hi! I'm trying to update the data in a field in my Form 1 by clicking a button in Form 2. Total disclosure: I'm not good at coding. Whatever codes I got, it's from Google. So, in Form 1, I have a code that computes the number of working days between the time I started a concern (StartDate) and the time I resolved it (ResolveDate). This data is logged in my DTR field and is triggered thru an If-Then code in VBA embedded in a button as an OnClick event. Now, sometimes, I have to update a lot of records, so I created an update query that would change the ResolveDate. This can be executed thru another button OnClick event, but this time, the button is found in my Form 2. Unfortunately, this does not update the DTR field since the code to compute the difference is embedded in a separate code. My question now is, is there a way to call the If-Then code to my button in Form2 so that when I click on it, both the ResolveDate and DTR field will be updated in my Form 1? Thank you!1.4KViews0likes4Comments