0
Tamamen kodlamak yeni. Erişimdeki bir buton tıklatmasının her biri bağımsız olarak değişken olan ve sürecin neden başarısız olduğuna dair hiçbir fikri olmayan 6 alanı bir araya getirdiği bir olay prosedürü oluşturmaya çalışıyorum. Olay yordamına bağlı Access'te hesapla kutusunu tıklattığımda bir hata bile almıyorum. İşte şimdiye kadar sahip olduğum şey.VB.net Access in Calculator
Opsiyon Veritabanı
Private Sub CalculateButton_Click()
Dim TotalIncomeAmt As Integer
Dim TotalSocialSecurityIncomeAmt As Integer
Dim TotalSocialSecurityBenefitAmt As Integer
Dim TotalChildSupportAmt As Integer
Dim TotalFoodStampAmt As Integer
Dim TotalOtherIncomeAmt As Integer
Dim GrandTotalIncome As Integer
If IFW - How_often_received = "Weekly" Then
TotalIncomeAmt = IFW_Amount * 4.25
End If
If IFW - How_often_received = "Bi-Monthly" Then
TotalIncomeAmt = IFW_Amount * 2
End If
If IFW - How_often_received = "Monthly" Then
TotalIncomeAmt = IFW_Amount
End If
If IFW - How_often_received = " " Then
TotalIncomeAmt = 0
End If
If SSI - How_often_received = "Weekly" Then
TotalSocialSecurityIncomeAmt = SSI_Amount * 4.25
End If
If SSI - How_often_received = "Bi-Monthly" Then
TotalSocialSecurityIncomeAmt = SSI_Amount * 2
End If
If SSI - How_often_received = "Monthly" Then
TotalSocialSecurityIncomeAmt = SSI_Amount
End If
If SSI - How_often_received = " " Then
TotalSocialSecurityIncomeAmt = 0
End If
If SSB - How_often_received = "Weekly" Then
TotalSocialSecurityBenefitAmt = SSB_Amount * 4.25
End If
If SSI - How_often_received = "Bi-Monthly" Then
TotalSocialSecurityBenefitAmt = SSB_Amount * 2
End If
If SSI - How_often_received = "Monthly" Then
TotalSocialSecurityBenefitAmt = SSB_Amount
End If
If SSI - How_often_received = " " Then
TotalSocialSecurityBenefitAmt = 0
End If
If CH - How_often_received = "Weekly" Then
TotalChildSupportAmt = CH_Amount * 4.25
End If
If CH - How_often_received = "Bi-Monthly" Then
TotalChildSupportAmt = CH_Amount * 2
End If
If CH - How_often_received = "Monthly" Then
TotalChildSupportAmt = CH_Amount
End If
If CH - How_often_receive_benefits = " " Then
TotalChildSupportAmt = 0
End If
If FS - How_often_received = "Weekly" Then
TotalFoodStampAmt = FS_Dollar_Amount * 4.25
End If
If FS - How_often_received = "Bi-Monthly" Then
TotalFoodStampAmt = FS_Dollar_Amount * 2
End If
If FS - How_often_received = "Monthly" Then
TotalFoodStampAmt = FS_Dollar_Amount
End If
If FS - How_often_received = " " Then
TotalFoodStampAmt = 0
End If
If OI - How_often_received = "Weekly" Then
TotalOtherIncomeAmt = OI_Amount * 4.25
End If
If OI - How_often_received = "Bi-Monthly" Then
TotalOtherIncomeAmt = OI_Amount * 2
End If
If OI - How_often_received = "Monthly" Then
TotalOtherIncomeAmt = OI_Amount
End If
If OI - How_often_received = "None" Then
TotalOtherIncomeAmt = 0
End If
GrandTotalIncome = (TotalIncomeAmt + TotalBenefitsAmt + TotalFoodStampAmt + TotalChildSupportAmt + TotalOtherIncomeAmt)
Total_Monthly_Income = GrandTotalIncome
End Sub
haftalık hesaplama '0.25' ile yapılabilir olmamalı:
O zaman bu gibi tüm kod blokları revize ? –
bu ne anlama geliyor IFW - How_often_received = "Weekly" '??? Okuduğum şey: 'HowWen' 'HowWert' 'ifadesinden' 'IFW' 'i çıkarmak ve sonucu' Weekly 'dizesiyle karşılaştır. Bunun benim için bir anlamı yok. Bunu her yerdesin. –
@ThomasG'nin revize edilmesine ihtiyaç duyulan ilk şey olduğunu belirtti. Yeniden değerlendirmek isteyebileceğiniz ikinci şey, çoklu koşulların doğru olabileceği ihtimalidir. Eğer durum buysa, değiştirmek istediğiniz: 'TotalIncomeAmt = IFW_Amount * 4.25' -' TotalIncomeAmt = TotalIncomeAmt + (IFW_Amount * 4.25) ' –