Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Combo Box with Bound Text Boxes

Status
Not open for further replies.

czechmate55

Technical User
Apr 12, 2010
11
US
Hello,
I have a combo box that needs to fill some text boxes when selected. However, the user will also need to edit the text boxes. Everywhere I've looked, I can only find info on UNbound text boxes.

This is what I have for the onChange event for my combo.

Private Sub Cbo_UnitNo_Change()
Me.txtApplDate = Me.RehabUnitID
Cbo_UnitNo.Requery
End Sub

Can you tell me if I am close to what I am trying to accomplish or am I way out in left field on this?
Thank you
 
Can you be a little more specific on what you are trying to do? When you change the combo (I would use after update), what textboxes do you want to fill and with what value.

if you want the value of the bound column in the combo box to fill txtAppDate then simply

Private Sub Cbo_UnitNo_afterUpdate()
Me.txtApplDate = me.cbo_UnitNo
End Sub

What are you attempting with the requery?
 
Hi MajP

It is a hospital Rehab and the combo box shows the room numbers on the floor. When the room number is selected, the patient's information is displayed. I have 2 text boxes that need edited. Admission Date and Discharge date. As the nurse pulls room 612, enters the date 5/5/2010 as the day the patient was admitted. When they are discharged, the nurse can pull room 612 again, the date 5/5/2010 is still in the Admission Date and she can then put the discharge date in the appropriate text box.
I really don't know why I put requery. Your question made me realize that was unnecessary.
Thanks
 
OK. Is there still a question. Do you want to use a combo to navigate to a record?
 
Hi MajP. I'm not sure if I still have a question or not. Your suggestion worked in that it changes the dates by the room number and I am able to edit them, but the dates are defaulting to January 1900. I'm trying to find out where it is getting the 1/14/1900 info to see if I am pulling something wrong in the row source of the combo box. So far I haven't found it. Have you ever seen this before? I'm going to keep looking...it is probably something right in front of my face.
Thanks!
 
Dates in vb are saved as numbers with the integer part equaling the number of days since the base date (13/30/1899), and a decimal part representing the fraction of the next day. What you see is a format of this number
For example using the cdate function to convert to a date

?cdate(1)
12/31/1899
1 day past the base date

?cdate(1.5)
12/31/1899 12:00:00 PM
1 day and a half past the base date

?cdate(15)
1/14/1900
15 days passed the base date

this tell me in your table or form you have a default likely set to 15 bedcause it is unlikely you accidently type 1/14/1900.

Right now the date and time is
40304.3974652778
40304 days past 12/30/1899
and .397... of a next day or
5/6/2010 9:32:21 AM
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top