B
Bob Vance
I am trying to get this code to add HorseID to tblDailyCharge.HorseID when I
update this form, but I am getting the error:
Number of query values and destination fields are not the same!
Private Sub subSetInvoiceDetailsValues()
CurrentProject.Connection.Execute "INSERT INTO
tblAdditionCharge(InvoiceID,ChargeID,HorseID,DayNo,ChargeNumber,AdditionCharge,
" _
& " AdditionChargeAmount)SELECT " & lngInvoiceID & "," & "ChargeID"
_
& "," & cbHorseName.value & ",DayNo,ChargeNumber,AdditionCharge, " _
& " AdditionChargeAmount FROM tmpAdditionCharge"
If IsNull(tbTotalDays1.value) = True Or tbTotalDays1.value = "" Then
Exit Sub
ElseIf IsNull(cbDailyCharge1.value) = True Or cbDailyCharge1.value = ""
Then
Exit Sub
'***TRY TO ADD HorseID HERE***
Else
CurrentProject.Connection.Execute "INSERT INTO
tblDailyCharge(InvoiceID,HorseID,StartDate,EndDate,TotalDays,DailyCharge, "
_
& " DailyChargeRate,DailyChargeAmount)Values(" & lngInvoiceID & ",'"
& Format(tbStartDate1.value, "dd/mm/yyyy") _
& "','" & Format(tbEndDate1.value, "dd/mm/yyyy") & "'," &
tbTotalDays1.value & ",'" & cbDailyCharge1.value _
& "'," & tbDailyChargeRate1.value & "," & tbDailyChargeAmount1.value
& ")"
End If
update this form, but I am getting the error:
Number of query values and destination fields are not the same!
Private Sub subSetInvoiceDetailsValues()
CurrentProject.Connection.Execute "INSERT INTO
tblAdditionCharge(InvoiceID,ChargeID,HorseID,DayNo,ChargeNumber,AdditionCharge,
" _
& " AdditionChargeAmount)SELECT " & lngInvoiceID & "," & "ChargeID"
_
& "," & cbHorseName.value & ",DayNo,ChargeNumber,AdditionCharge, " _
& " AdditionChargeAmount FROM tmpAdditionCharge"
If IsNull(tbTotalDays1.value) = True Or tbTotalDays1.value = "" Then
Exit Sub
ElseIf IsNull(cbDailyCharge1.value) = True Or cbDailyCharge1.value = ""
Then
Exit Sub
'***TRY TO ADD HorseID HERE***
Else
CurrentProject.Connection.Execute "INSERT INTO
tblDailyCharge(InvoiceID,HorseID,StartDate,EndDate,TotalDays,DailyCharge, "
_
& " DailyChargeRate,DailyChargeAmount)Values(" & lngInvoiceID & ",'"
& Format(tbStartDate1.value, "dd/mm/yyyy") _
& "','" & Format(tbEndDate1.value, "dd/mm/yyyy") & "'," &
tbTotalDays1.value & ",'" & cbDailyCharge1.value _
& "'," & tbDailyChargeRate1.value & "," & tbDailyChargeAmount1.value
& ")"
End If