Message Box/Coding issue

caferacer

Registered User.
Local time
Today, 07:27
Joined
Oct 11, 2012
Messages
96
Hi All,

I am using the code below to highlight to the DB user that a piece of equipment is available from two suppliers or vendors.

I am using a form named Equipment which has a checkbox named MultipleSource and Label51 embedded. The form (Equipment) is used both independently and also as as subform.

When using the Equipment form independently on its own, the code works fine, but when the Equipment form is used as a subform, when DCount is >1 the code runs fine, apart from the MsgBox pops up consequitively 4,5 or sometimes even 6 times?

I have disabled other code to see if there is any improvement, but no change.

Any ideas?

Thanks in advance.

Mark

(Access2003).

If DCount("*", "tbl VendorEquipmentJUNCTION", "[EquipmentID] = " & Me!EquipmentID) > 1 Then
Me.MultipleSource = -1
Me.Label51.FontBold = True
Me.Label51.ForeColor = vbRed
Me.Label51.BackStyle = 1
Me.Label51.BackColor = vbYellow
Command68.Visible = True
MsgBox "Multi Source item"

Else

Me.MultipleSource = 0
Me.Label51.FontBold = False
Me.Label51.ForeColor = vbBlack
Me.Label51.BackStyle = 0
Command68.Visible = False

End If
 
Hi Pat,

Yeah sorry about the important lack of info - it is the forms Current Event which the code is called from.

The form is displayed as a Single Form, so will your opening comment still influence this? Should I still look at conditional formatting?

Thanks for you help.

Regards

Mark.
 

Users who are viewing this thread

Back
Top Bottom