Invoice Creation / Subform

G

Guest

good day all,

I have created a form/subform for my invoice creation, there is just one
thing that is stumping me.

Well, first I guess I should explain one thing that is used in my subform:

My subform is based on my products/inventory table in which each of my
inventory items has a distinct serial number.

So in my subform, when I am creating an invoice, I want the user to only
have the option to choose the product once for the invoice.

I have serialnum, itemdescript, and unit price on my subform.

the serialnum is a lookup on my products table, and as it is right now if
a user choose serialnum NW-0001 for the first product on the invoice and then
goes to add a new record, the system is allowing for that record to be
choosen again.

And I want to prevent this.

I hope this is clear and I hope someone can help.

Thanks in advance.

Brook
 
A

Alex

Hi Brook,

no problem, you need to set an event

BeforeUpdate(Cancel As Integer) for your control

in that event you need to verify that your happy with the value
entered.

something like

dim adoInv_Check as new adodb.recordset
dim sql as string
sql = "Select count(*) as total from Tblinvoice_Details Where
serialnum='" & me.txtcontrol.value & "'" and invoice_number=" &
me.invoice_number
with adoInv_Check
.open sql, currentproject.connection, adOpenKeyset, adLockReadOnly
if not isnull(.fields("Total").value) then
if .fields("Total).value > 0 then
cancel = 1
end if
end if
.close
end with

you need to double check that the event is being canceled on double
entry. The above code will need some modification, but it give you an
idea of what to do.

Hope it helps, if you have any problems just post back here.

Regards

Alex
 
G

Guest

Alex,

Thanks for the info, I am going to give this a shot and see how this works.

I will post a response no matter what...

Brook
 

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

Top