Increasing a counter due to a particular event

  • Thread starter Thread starter Marc
  • Start date Start date
M

Marc

Dear All,

In order a speed up the shipment samples I built a database in Access 2K.
Since all the products which have to reach countries outside the EU
(European Union) must have an attached proforma invoice, I should need a
counter which increase its number if a boolean field is false.

The main form DataEntry has several fields, three of them are comboboxes. At
the first time one select the [Continent] in the 1st combobox, afterwards in
the second combobox only the countries that belong to that continent are
shown (filtered), and so on ....

After updating the country, in the DataEntry form a boolean field, called EU
(European Union), is bounded to the [Country] combobox. If a country belongs
to EU the boolean field is picked (true), if not, it is not checked (false).

Now it comes the difficult task for me:
How and where can I insert the following VB code in the form, so that the
counter increases its number only if the boolean field is false (the country
doesn't belong to EU)

Private Sub Form_Current()
If EU = False Then
On Error Resume Next 'It should never occur, just to be sure...
Me!ProformaInvoiceN°.DefaultValue = Nz(DMax("[ProformaInvoiceN°]",
"tblDataEntry"), 3022) + 1
End If
End Sub

At the moment the routine is inserted to the Cuttent Form event, but in this
way with every new record the couter increase the number.

I should be very greatful if someone could help me.

Thanks in advance,
Marc
 
After_update() event of the Country field seems to be the event y're looking
for
Krgrds,
Perry
 
Perry said:
After_update() event of the Country field seems to be the event y're looking
for
Krgrds,
Perry


Hi Perry,
I am sorry, but it doesn't work, anyway thanks the same for y/reply.
KndRgrds
Marc
 
Try to refresh the form after you pull a number to store as default value
for the proforma invoice.
It's the default value property y're trying to push the value to,
the form needs to be refreshed/requeried.

Put following in the same afterupdate event:
me.refresh
or
me.requery

Krgrds,
Perry
 
[Cut]
Try to refresh the form after you pull a number to store as default value
for the proforma invoice.
It's the default value property y're trying to push the value to,
the form needs to be refreshed/requeried.

Put following in the same afterupdate event:
me.refresh
or
me.requery

Krgrds,
Perry

Hi Perry,
I did it as you advised me, but it doesn't work yet. I bypassed the problem,
building an external query which filters in an other form all the "is not
null" ProformaInvoiceN°, so that the final user can manually insert (write)
the progressive number.
I should have liked something of automatic, because the final user has no
computer aptitude. Anyway, the database is ready now and it an be used. In
the near future I can research & develop the troobleshooting of this step.

Thanks again for your haelp and if you have further ideas, pls let me know.
Kind regards,
Marc
 
Back
Top