|
-
Aug 15th, 2000, 10:28 AM
#1
Thread Starter
Member
i have 2 textbox (Customer Code, Customer Name) which if i key in the customer code in first textbox, the program will display the customer name on 2nd textbox automatically (where the customer data store in database using ODBC). What should i do so that this method can executed without using any command button.
TQ.
CK
-
Aug 15th, 2000, 11:00 AM
#2
Lively Member
You could always use the dastardly 'lost focus' event. When user leaves the text control search your database (or recordset if you already have the data) for the appropriate customer name (and vice-versa).
If u'r not adding customers I'd get the data into two combo boxes. If allowing key presses search combo for next match and point search the recordset for appropriate name to go in the name combo. More work but it's neater and you don't need the 'lost focus' then.
Anakim
It's a small world but I wouldn't like to paint it.
-
Aug 15th, 2000, 08:55 PM
#3
Thread Starter
Member
If i want to use 'lost focus' control, what code should i put between the command?
-
Aug 15th, 2000, 09:56 PM
#4
Fanatic Member
Hi leeckeat,
Just cut your present code from the command button and paste it into the Lost_Focus event of the textbox. It's as simple as that. 
All the best.
-
Aug 16th, 2000, 12:43 AM
#5
Thread Starter
Member
wrong coding?
i using if...then..else statement but when i run the program, it "hang" there. I need to press ctrl+break to stop the program.
code:
Set rstTemp = Db.OpenRecordset("select * from Customer", dbOpenDynaset)
Do While Not rstTemp.EOF
If rstTemp.Fields(0) = Text1.Text Then
rstTemp.Fields(1) = Text2.Text
End If
rstTemp.MoveNext
Loop
rstTemp.Close
-
Aug 16th, 2000, 02:53 AM
#6
Member
hi leeckeat.... you're displaying it on a textbox rite???
instead of rstTemp.Fields(1)=Text2.text, isn't it supposed to be Text2.Text=rstTemp.Fields(1).....
Code:
Set rstTemp = Db.OpenRecordset("select * from Customer", dbOpenDynaset)
Do While Not rstTemp.EOF
If rstTemp.Fields(0) = Text1.Text Then
Text2.Text=rstTemp.Fields(1)
End If
rstTemp.MoveNext
Loop
rstTemp.Close
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
|