One Control for 2 codes


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
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 +

sngGstPercentage = Nz(recGSTOptions.Fields("GSTPercentage"), 0)
tbRate.value = sngGstPercentage
tbRate2.value = sngGstPercentage
bModify = True
cmdCalculate.Enabled = True
cbGSTOptions.Enabled = True
cmdModify.Enabled = False

End If
End Sub



Bob Vance

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

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

If CurrentProject.AllForms("frmActiveHorses").IsLoaded = True
cbOwnerName.value = Form_frmActiveHorses.cboClient.value
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)

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads