Hildegoat15
Technical User
Hi,
i've made a form which allows people to transfer region (RHA) or CPL. Based on the transfer they want to do, i run the appropriate INSERT INTO statment to add a record to the Transfer History table, putting nulls into the fields which aren't applicable. It works fine for the RHA transfer, but the CPL gives me an error saying :
Too few parameters. expected 2.
my insert statements look like this. the first one is the one that works:
CurrentDb.Execute "INSERT INTO Transfer(ClientID, OldRHA, NewRHA, OldCPL, NewCPL, TransferDate) VALUES ('" & Me!txtClientID & "', " & Me!txtOldRHA & ", " & Me!txtNewRHA & ", null, null, #" & Format(Me!txtTransferDate, "mm/dd/yyyy" & "#);", dbFailOnError
This one doesn't:
CurrentDb.Execute "INSERT INTO Transfer(ClientID, OldRHA, NewRHA, OldCPL, NewCPL, TransferDate) VALUES ('" & Me!txtClientID & "', null, null, " & Me!txtOldArea & ", " & Me!txtNewArea & ", #" & Format(Me!txtTransferDate, "mm/dd/yyyy" & "#);", dbFailOnError
since RHA is a numeric field, i tried putting zeroes instead of nulls, but i get the same error. CPL is a text field, by the way. I'm thinking a fresh set of eyes could help me out, so if you see any way i could fix my error, it'd be much appreciated. -Matt
i've made a form which allows people to transfer region (RHA) or CPL. Based on the transfer they want to do, i run the appropriate INSERT INTO statment to add a record to the Transfer History table, putting nulls into the fields which aren't applicable. It works fine for the RHA transfer, but the CPL gives me an error saying :
Too few parameters. expected 2.
my insert statements look like this. the first one is the one that works:
CurrentDb.Execute "INSERT INTO Transfer(ClientID, OldRHA, NewRHA, OldCPL, NewCPL, TransferDate) VALUES ('" & Me!txtClientID & "', " & Me!txtOldRHA & ", " & Me!txtNewRHA & ", null, null, #" & Format(Me!txtTransferDate, "mm/dd/yyyy" & "#);", dbFailOnError
This one doesn't:
CurrentDb.Execute "INSERT INTO Transfer(ClientID, OldRHA, NewRHA, OldCPL, NewCPL, TransferDate) VALUES ('" & Me!txtClientID & "', null, null, " & Me!txtOldArea & ", " & Me!txtNewArea & ", #" & Format(Me!txtTransferDate, "mm/dd/yyyy" & "#);", dbFailOnError
since RHA is a numeric field, i tried putting zeroes instead of nulls, but i get the same error. CPL is a text field, by the way. I'm thinking a fresh set of eyes could help me out, so if you see any way i could fix my error, it'd be much appreciated. -Matt