Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Check for duplicate record (2 fields)
Message
From
26/02/2004 17:07:28
 
 
To
26/02/2004 15:51:30
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00881146
Message ID:
00881277
Views:
15
I'm sorry. I'm not exactly clear on what you're trying to accomplish. It sounds like you're trying to prevent a duplicate SiteCode from being entered via a ComboBox.

If so try doing something like this in the Valid method (I haven't tested this):
llRetVal = .T.
lnOrigArea = Select()
lcValue = This.DisplayValue

Select (SiteCodeTable)
Locate for SiteCode = lcValue
If Found()
  =MessageBox("Message to user")
  llRetVal = .F.
Endif 
Select (lnOrigArea)
Return llRetVal
As for the other things, again I'm not really sure what's going on, but some suggestions...

>1. Can type a value only once. i.e. assume values are A and B, then if I type an A I cannot type a B in its place but I can only change it via the drop down list.

Is the ControlSource only 1 character long? If so you might have to highlight and delete the value before typing another one.

>2. When a new value is type in instead of being set by the drop down list its not always validate the new value, i.e. if records exist for A and B it does not display the message that data already esists and moves to the next field as if value is ok. Save does produces an error message but I want to avoid that.

Instead of using the the combo's .value property try using the .displayvalue property.

Aloha,

James
Previous
Reply
Map
View

Click here to load this message in the networking platform