THANKS,DONE IT
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
Else
CurrentProject.Connection.Execute "INSERT INTO
tblDailyCharge(InvoiceID,StartDate,EndDate,TotalDays,DailyCharge, " _
& " DailyChargeRate,DailyChargeAmount, HorseID)Values(" &
lngInvoiceID & ",'" & Format(tbStartDate1.value, "dd/mm/yyyy") _
& "','" & Format(tbEndDate1.value, "dd/mm/yyyy") & "'," &
tbTotalDays1.value & ",'" & cbDailyCharge1.value _
& "'," & tbDailyChargeRate1.value & "," & tbDailyChargeAmount1.value
& "," & cbHorseName.value & ")"
End If
"Bob Vance" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>
> "Bob Vance" <(E-Mail Removed)> wrote in message
> news:OrN%(E-Mail Removed)...
>>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
>> --
>> Thanks in advance for any help with this......Bob
>> MS Access 2007 accdb
>> Windows XP Home Edition Ver 5.1 Service Pack 3
>>
>>
> OOPS HorseId is first column of cbHorseName
> .Fields("HorseID") = cbHorseName.value
>