Results 1 to 6 of 6
  1. #1
    Join Date
    Aug 2004
    Posts
    22

    Unhappy Unanswered: The easier question of Access I was made...

    Hi

    I have a little trouble in Access, I want to populate my textbox from a query object in Access (2002), yes, only that but sincerelly I missed how can I do that. I could use access direct method (an assistants-hit or something) but I want to use code, because I want to populate this textbox based on an specific sql search, I failed miserably ... plz help


    Code:
    Option Compare Database
    
    
    Private Sub cmdActualizaActualizar_Click()
    
    Dim MyConn As ADODB.Connection
    Dim rs As ADODB.Recordset
    Dim strName As String
    Dim strAddress As String
    Dim strPhone As String
    
    Set MyConn = New ADODB.Connection
    MyConn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Documents and Settings\DAVIDG\Escritorio\new1\Data.mdb;"
    MyConn.Open
    
    Set rs = MyConn.Execute("SELECT Demanda, Punta FROM tblTarifas")
    
    Me.txtDemandaAnterior.Text = rs!Demanda
    
    MyConn.Close
    
    End Sub


    I know this could be easy for u, but I really hard for me... ,
    Thnks for ur help

    David Garcia

  2. #2
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    How can one text box contain a whole recordset?

    What do you REALLY want to do here?
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

  3. #3
    Join Date
    Sep 2003
    Posts
    228
    You sure you don't want to populate a list box or a combo box?

  4. #4
    Join Date
    Aug 2004
    Posts
    22

    The question now change!

    I have solved this stupidity, just by change text for value in the code, also I have another interesting question regards Textbox...

    I have a two combobox (one for the month and the other for year), that I want is to take the values of this combos and "joint" into onte textbox stores the first day of the specific month and year (my date format is DD/MM/YYYY)

    for example I put in the combo1 - September and combo 2- 2004

    And I want to textbox shows.

    "01/09/2004" or "01/september/2004"

    I think I first need to set combo1.text = string, but before that I don't really know how can I do this.

    Thnks for ur comments

  5. #5
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    Where does the 01 come from? Do you want it to default to the first of the specified month?

    Use the afterupdate event of the combo boxes to parse and assign the string to your text box.
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

  6. #6
    Join Date
    Aug 2004
    Location
    Steamboat Springs, CO
    Posts
    37
    DateSerial([combo 2], [combo 1], 1)

    if this is the source of your text box and combo 2 has the year and combo 1 has the month, then this will give you the 1st date of that month
    Last edited by meremyb; 09-23-04 at 18:24.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •