473,396 Members | 1,743 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

display combo box value at Form load event isue

Hi community experts,

May I knw hw can the values of the combo box be displayed at combo box afterupdate event. I want to achieve in such a way whereby at the form load the value displayed at the combo box will be displayed at the textboxs as well.
Let say S1 happens to be displayed in form load, which mean that values (StudentId, name) corresponding to S1 will be displayed as well.

Expand|Select|Wrap|Line Numbers
  1. Combo box - StudentId (unbounded)
  2. TextBoxes - StudentId (unbounded)
  3.                    name (unbounded)
Code

Expand|Select|Wrap|Line Numbers
  1. Private Sub Combo1_AfterUpdate(Cancel As Integer)
  2. Dim stud As Variant
  3. stud = DLookup("StudentId", "Student", "StudentId = '" & Me.Combo1.Column(0) & "'")
  4. Me.StudentId.Value = stud
  5. End Sub
Feb 7 '07 #1
1 4064
Rabbit
12,516 Expert Mod 8TB
Hi community experts,

May I knw hw can the values of the combo box be displayed at combo box afterupdate event. I want to achieve in such a way whereby at the form load the value displayed at the combo box will be displayed at the textboxs as well.
Let say S1 happens to be displayed in form load, which mean that values (StudentId, name) corresponding to S1 will be displayed as well.

Combo box - StudentId (unbounded)
TextBoxes - StudentId (unbounded)
name (unbounded)

Code
Expand|Select|Wrap|Line Numbers
  1.  
  2. Private Sub Combo1_AfterUpdate(Cancel As Integer)
  3. Dim stud As Variant
  4. stud = DLookup("IStudentId", "Student", "StudentId = '" & Me.Combo1.Column(0) & "'")
  5. Me.StudentId.Value = stud
  6. End Sub.
If you want it the code to run at form load then put the code in the form's On Load event.

Also, you don't need the mediating stud variable you can just go ahead and assign it directly to StudentId.Value.
Feb 7 '07 #2

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

Similar topics

4
by: jcazmail-groups | last post by:
I have a child form that has a combo box whose underlying query needs to be filtered by a value from a combo box on the parent form. I have succeeded in doing this by putting the following SQL in...
2
by: Jeff Mason | last post by:
I'm observing some strange behavior when I use a bound combo box in conjunction with the combo's anchor property. I define a form which contains just a textbox and a combo box. The text box is...
5
by: Agnes | last post by:
Can combo box return more that 1 item ?? for my currency combo box, short_code, descripiton, currency rate. as user choose the description, I need to get both short_code & currency rate result. ...
2
by: Ausclad | last post by:
Hi, I have a combo box that I want to populate, based on the selection of another combo box. So when combo box A is selected, combo box B is populated with related values. I have this all...
7
by: luanhoxung | last post by:
hi all!! i get small trouble in display a text box. My text box will be show a value string base on my combo box choice. But text box always get the same value when i choose a new value in combo...
1
by: The Eclectic Electric | last post by:
I'd be very grateful if anyone could help me with this. From my limited knowledge of Javascript I don't think it is possible, but I'll punt anyway. I downloaded and very slightly adapted this...
5
by: Tark Siala | last post by:
hi dear i'm programmer with VB6, but now i starting with C#. first problem is coming when i need fill "ComboBox Control", as you know when i fill combobox in VB6 by this code: comboX.AddItem...
4
kcdoell
by: kcdoell | last post by:
Hello: I have a form that has 3 combo boxes. CboDivision cboWrkReg cboCreditReg In the Field Properties, of those combo boxes I used the “Default Value” to populate selections that were...
8
by: ZaphodBBB | last post by:
Hi I have a form frmAdd_Equipment. It has a number of combo boxes on it, cboModel, cboSupplier, cboManufacturer, cboEquipment_Type etc. Bcause therer is no existing data to go off I put an ADD...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.