|
-
Mar 14th, 2003, 05:49 PM
#1
Thread Starter
Lively Member
Combo box and database
Hi!
I a problem which I would appreciate sime help on!
what I am trying to do is select a name from a list and get my program to display the record in the database for the selected surname.
what I Have at the moment is:
Private Sub cmdFind_Click()
Const Apos As String = "'"
Dim Target As String
Surname = InputBox("What is the Surname?")
Target = "Surname = " & Apos & Surname & Apos
Combo2.Clear
datSponsor.Recordset.FindFirst Target
Do Until datSponsor.Recordset.NoMatch
Combo2.AddItem datSponsor.Recordset("Surname") datSponsor.Recordset.FindNext Target
MsgBox ("Select Surname from Drop down List")
Loop
End Sub
This works fine as it searches with just the surname using the following code:
Private Sub cmdFind2_Click()
Target = "Surname = " & "'" & Combo2.Text & "'"
datSponsor.Recordset.FindFirst Target
End Sub
However the problem is when I use the code:
Combo2.AddItem datSponsor.Recordset("Surname") & (" ") & datSponsor.Recordset("Forename")
to display the surname and the forename in the combo box and don't have a clue when using two criteria i.e. surname, forename to dispaly the whole record!
Could someone please help me out?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|