One Control for 2 codes

  • Thread starter Thread starter Bob Vance
  • Start date Start date
B

Bob Vance

My Combo Box cbGSTOptions selects either tax or no tax but after making my
selection I need to update with another control form the calculation to work
Control 2 is under the line====
Can I incorporate these two code to just the Afterupdate of my Combo Box
----------------------------------------------------------------------
Option Compare Database
Option Explicit

Dim recInvoice_ItMdt As ADODB.Recordset
Dim recInvoice As ADODB.Recordset, dblGSTContentsValue As Double,
lngIntermediateID As Long
Dim dblGSTOptionsValue As Double
Dim bModify As Boolean
Dim ynCheque As Boolean, lngInvoiceID As Long, strExpressionOrgument As
String
Dim sngGstPercentage As Single, recGSTOptions As ADODB.Recordset
Dim bLockFlag As Boolean
-------------------------------------------------------------------------------
Private Sub cbGSTOptions_AfterUpdate()

Set recGSTOptions = New ADODB.Recordset
recGSTOptions.Open "SELECT * FROM tblGSTOptions WHERE GSTOptionsText
LIKE '" _
& cbGSTOptions.value & "'", CurrentProject.Connection,
adOpenDynamic, adLockOptimistic

If recGSTOptions.EOF = True And recGSTOptions.BOF = True Then
MsgBox "Invalid GSTOption.", vbApplicationModal + vbInformation +
vbOKOnly


sngGstPercentage = Nz(recGSTOptions.Fields("GSTPercentage"), 0)
tbRate.value = sngGstPercentage
tbRate2.value = sngGstPercentage
'============================================================
bModify = True
cmdCalculate.Enabled = True
cbGSTOptions.Enabled = True
cmdCalculate.SetFocus
cmdModify.Enabled = False
Forms!frmMain!lstModify.Requery

End If
End Sub
 
I actually changed it to a list box and change the code to that form and
list box and it worked perfectly
But now I must incorperate bote forms and list boxes to use the one code,
the adjusted code below works fine
I also had to change the ddate also to the new Form and list box
is it possible to have both incorperated......Thanks Bob

Else
recInvoice.Open "SELECT * FROM tblInvoice where InvoiceID=" &
Form_frmOverviewClient.lstClientInvoice.value _
, CurrentProject.Connection, adOpenDynamic, adLockOptimistic
subShowInvoiceValues
subShowInvoiceDetailValues

If CurrentProject.AllForms("frmActiveHorses").IsLoaded = True
Then
cbOwnerName.value = Form_frmActiveHorses.cboClient.value
Else
cbOwnerName.value = recInvoice.Fields("OwnerID")
End If

bModify = True

Dim dDate As Date
Dim dtDiff
Dim nCountDaysOfYear As Long
Dim nLeapYearNow As Long, nLeapYearOfBillYear As Long
Dim nTotalDays As Long
dDate = Form_frmOverviewClient.lstClientInvoice.Column(2)
 
Back
Top