three listboxes from same table issue

rsbutterfly16

Registered User.
Local time
Today, 10:10
Joined
Jun 5, 2006
Messages
77
hi guys, i was wondering if you can help me. I have a data entry form in which the user has three listboxes from an existing table (only one table for the three listboxes). however if the user selects the same item from listbox1 in listbox2 or listbox3, i want him to get an error message and don't let that happen. how can i do this? vba code?:confused:

this is my form:

Please select your three items of choice.

1st choice 2ndchoice 3rdchoice
listbox1 listbox2 listbox3


listbox1.value cannot equal listbox2.value and cannot equal listbox3.value.
 
cant you have a simple if statement after each button press or each update?

if listbox1.value = listbox2.value OR listbox1.value = listbox3.value then
MsgBox("cant do it")
end
else
whatever you do after
end if
 
Last edited:
this is what i have inthe list2 update but it does not work


Dim int1 As Integer, int2 As Integer, int3 As Integer

int1 = List1.Value
int2 = List2.Value
int3 = List3.Value

If int2 = int1 Then
MsgBox "Secord choice cannot equal First choice"
Else
End If
End Sub
 
does it not display the message at all? have you debugged it to see the values its assigning to int1, int2 and int3? you should alse put and "end" in before the "else"
 
thanks!!! now is there a way to make it if i chose item 1 in listbox1 that it does not come out in the listbox2 and 3?
 
you need a query based on the table the listbox is displaying from.
you want it triggering the query after the update of the first list box
xxxxx_afterupdate
DoCmd.openquery("queryname")

yous hould probably have a text box holding the ID of the item selected in the first box then
In the criteria for the query you want to filter the values but omit the value with the selected ID(taken from the text box)
 

Users who are viewing this thread

Back
Top Bottom