I have the similar case like that

irshaad84

Estimable
Nov 14, 2014
4
0
4,510
I'm doing a project in vb6 i have a data where when i search it should give multiple answers in combo box. example i have a debtor code each debtor code as more than one addresses when i search in one debtor code how can i get multiple addresses in the combo box. my search engine command as follows
Adodc1.Recordset.MoveFirst
Adodc1.Recordset.Find "DEBTOR_CODE = '" & Text11.Text & "'"
If Adodc1.Recordset.EOF = True Or Adodc1.Recordset.BOF = True Then
MsgBox "Record Not Found!"
vbApplicationModal Adodc1.Recordset.MoveFirst
Me.Combo1.SetFocus
Me.Combo1.ListIndex = Me.Text11.Text
End If

Can anyone help me to solve this
 
Ok. Let's take this step by step.

First line: Move to the first record of the record set.
Second line: Find a record set equal to the text, "DEBTOR_CODE = '{Text11 textbox data}'"

/* Now realizing you're still at the beginning of the file you query */

Third line: If the recordset is at the end of file (False) or the recordset is at the beginning of the file (True) Then...
Fourth line: Open a message box to state "Record Not Found!"
Fifth line: Move back to the first record
Sixth line: Reset focus onto the combo box
Seventh line: Set the selected option of the combo box to the text of the text box.

There is no else clause. If your "IF" statement is true, then it performs the commands below. If it isn't true, it does nothing until the "END IF" statement. Your "IF" statement should read,
Code:
 " If adodc1.RecordSet.EOF = True AND adodc1.RecordSet.BOF = True then "
This is how you check for zero records in your record set. If no records are found, then execute the commands you have.

If records are found in the recordset, then you will need to add an "else" statement just before your current "End If" statement which creates an output of your addresses, concatenated to each other in the format that you want.

-Wolf sends
 

irshaad84

Estimable
Nov 14, 2014
4
0
4,510
Thanks bro, but i'm bit clueless my scenario is this i have search text box (the mentioned codings above) where i have to search debtor_code to get the multiple answers in the combo box, answers are the addresses, say one debtor_code has multiple addresses if so what are the changes i have to do? do i want to add any codes to combo box as well, suppose if i select the answer from the combo box it should update in my remaining fields,

i have 3 text boxes
1) address_1
2) address_2
3) address_3

if i search a debtor_code in my search box i should get list of addresses in the combo box, if i select an answer from the combo box it should update my given text boxes how can i do that? please help