On Dbl Click - MultiSearch Specific Column (1 Viewer)

AlexJimenez

New member
Local time
Yesterday, 16:56
Joined
Sep 11, 2013
Messages
3
Hello all,
Ok so I am not sure if what I want to accomplish is possible but here it goes.
I have a form "FRM_SearchMulti" which has a list box with 3 columns "PROVIDER_NAME", "TIN", and "NPI". I want to be able to have the user search and double click on the column they want (either "PROVIDER_NAME", "TIN", or "NPI") and once they have double clicked it I want it to open the main form "Contract_Submission" with the entry they searched for. Want I can't figure out is how to make it so that if they double clicked on an "NPI" the main form searches for the "NPI" field or if they double click on a "TIN" the main form searches the "TIN" field. Since it is a list box with 3 columns it highlights the entire row so if they search for example "PROVIDER_NAME" but the entry also has the "TIN" and "NPI" it highlights all 3 available items. Not sure if this is very clear it's pretty hard to even explain. :banghead:. Any help is greatly appreciated.
 

Ranman256

Well-known member
Local time
Yesterday, 19:56
Joined
Apr 9, 2015
Messages
4,339
create 3 queries:
qsName: query the table on only the provName field that looks at the listbox
select * from table where [provider_name]=forms!frm_searchmulti_lstBox

same deal with qsTin, and qsNpi, using their single field.
create a macro, put all 3 queries in it.
dbl-click will run this macro. the macro opens the queries.

NOTE: you cannot query on lstBox.column(2) or 3 etc. ONLY the bound column.
So to fix this , make 2 text boxes
txtTin and txtNpi to hold the values in the columns. Place the value in the afterupdate event of the list box

Code:
sub lstBox_afterupdate()
  txtTin = lstbox.column(2)
  txtNPI = lstbox.column(3)
end sub
THEN query the npi from the txtNpi box.
remember , in vba , columns start at zero.
 
Last edited:

Users who are viewing this thread

Top Bottom