471,316 Members | 1,026 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,316 software developers and data experts.

display corresponding value textbox value issue

Hi community experts,

May I knw whether is it possible to display the corresponding value of the second textbox based on the user input in the first textbox? This means that once the user enters the value of first textbox - S1, the corresponding matching value based on first textbox will be displayed in the second textbox automatically.

I have tried using the AfterUpdate() event of textbox1 control to trigger this scenario but doesnt seem to be working. Perhaps that is not the correct event for this scenario.

Alternatively, I have also thinking of using two contols for this scenario, textbox and combo box respectively. Textbox will accept user input and combo box will populate or filter the result (corresponding value) based on the first textbox. Hence, nt too sure as to how that can be achieved. Hence, any advice, direction or code snippets are very much appreciated!

Scenario

Student table
StudentId S1 S2 S3
Name Peter Shaun Alfred

Student table view
StudentId - datatype(text), primary key
Name - datatype(text)

Form design

Student profile

StudentId - unbounded textbox1
Name - unbounded textbox2

or

StudentId - unbounded textbox1
Name - unbounded combo box1
Feb 2 '07 #1
3 3018
ADezii
8,826 Expert 8TB
Hi community experts,

May I knw whether is it possible to display the corresponding value of the second textbox based on the user input in the first textbox? This means that once the user enters the value of first textbox - S1, the corresponding matching value based on first textbox will be displayed in the second textbox automatically.

I have tried using the AfterUpdate() event of textbox1 control to trigger this scenario but doesnt seem to be working. Perhaps that is not the correct event for this scenario.

Alternatively, I have also thinking of using two contols for this scenario, textbox and combo box respectively. Textbox will accept user input and combo box will populate or filter the result (corresponding value) based on the first textbox. Hence, nt too sure as to how that can be achieved. Hence, any advice, direction or code snippets are very much appreciated!

Scenario

Student table
StudentId S1 S2 S3
Name Peter Shaun Alfred

Student table view
StudentId - datatype(text), primary key
Name - datatype(text)

Form design

Student profile

StudentId - unbounded textbox1
Name - unbounded textbox2

or

StudentId - unbounded textbox1
Name - unbounded combo box1
Expand|Select|Wrap|Line Numbers
  1. Private Sub TextBox1_AfterUpdate()
  2.   Me![TextBox2] = DLookup("[Name]", "tblStudent", "[StudentID]='" & Me![TextBox1] & "'")
  3. End Sub
Feb 2 '07 #2
tks MAN! that works great
Feb 2 '07 #3
Hi AdeZii & community experts,

I would like to knw whether is it possible to reset (empty) the fields at the form load event without affecting the values of the fields? Because StudentId is my primary key, if i rest the field at form load event, the table values got erase automatically. I want to achieve in such a way, whereby, the resetting of fields at form load wont cause any impact of the data in the table.

Another issue that I would like to seek your consultant is to lock the data of the table so that user cannnot edit the values in it. Tks! (insert, update) from form is still allowed jux that dnt allows user to edit the existing records in the table.

Private Sub Form_Load()
StudentId.Value = ""
Name.Value = ""
Feb 2 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

reply views Thread by Steve | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.