Hi again
I am hoping there is a quick easy solution to this.
I have a listbox and a textbox among several controls on my form. I have setup code to automatically populate the textbox but i want the value in the textbox to be checked or validated against values in a listbox and if the entry exists, display a message box and delete the textbox value and setfocus on it for the user to make another selection.
Due to the limited nature of VBA compared to VB i do not have all the options..
An example code would be
if me.textbox.value = me.listbox.item?? then
msgbox("This item already exists")
me.textbox.value = ""
me.textbox.setfocus
else
end if
...
naturally the above code wont work in VBA and thats where I'm stuck. Can anyone help with this?
I am hoping there is a quick easy solution to this.
I have a listbox and a textbox among several controls on my form. I have setup code to automatically populate the textbox but i want the value in the textbox to be checked or validated against values in a listbox and if the entry exists, display a message box and delete the textbox value and setfocus on it for the user to make another selection.
Due to the limited nature of VBA compared to VB i do not have all the options..
An example code would be
if me.textbox.value = me.listbox.item?? then
msgbox("This item already exists")
me.textbox.value = ""
me.textbox.setfocus
else
end if
...
naturally the above code wont work in VBA and thats where I'm stuck. Can anyone help with this?
Last edited: