Results 1 to 6 of 6
  1. #1
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    textbox not filled correct (2000)

    I use this code in vb6 to fill textbox.
    but the related textbox not are filed correct!!!!????
    see in Private Sub BOXCOPE_KeyPress(KeyAscii As Integer)

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: textbox not filled correct (2000)

    Please explain exactly what your problem is.

  3. #3
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: textbox not filled correct (2000)

    coonection string and littl e mdb
    use 45000012M for test

    Private Sub Form_Load()

    'Set DB1 = DBEngine.OpenDatabase("GCD01F4500DATIPUBBLICAANTIR ICANAGRAFICA.MDB")
    Set DB1 = DBEngine.OpenDatabase("D:ANAGRAFICAANAGRAFICA.MDB" )
    Set RSD1 = DB1.OpenRecordset("ANAGRAFICA1")
    Set RSD2 = DB1.OpenRecordset("APP")
    lblMsg.Caption = "INSERIRE UN COPE, POI PREMI INVIO"

    End Sub

  4. #4
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: textbox not filled correct (2000)

    Code removed by HansV because it had already been posted and because it was unreadable

    this code match if COPE1 if is present in filed COPE.
    Now if is found fill related texbox but the routine to fill the texzt box if filled alway with data of first rsd(?!)

  5. #5
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: textbox not filled correct (2000)

    hI HANS DONT WORRY!
    Solved to insert primary key in filed COPE...
    All work fine...tks in other case!
    Sal.

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: textbox not filled correct (2000)

    You have placed a line

    On Error Resume Next

    before the line that searches for the record. This line hides all error messages, so you don't get a message that the search code cannot be executed.
    There is no index named COPE on the ANAGRAFICA1 table, so the line

    rsd1.Index = "COPE"

    causes an error, and the rest of the code is not valid any more, but you have suppressed the error message. To correct this:

    1) Remove the line

    On Error Resume Next

    2) Change the line

    Set rsd1 = db1.OpenRecordset("ANAGRAFICA1")

    to

    Set RSD2 = db1.OpenRecordset("ANAGRAFICA1", dbOpenDynaset)

    This is necessary to be able to search the table.

    3) Remove the line

    Set RSD2 = DB1.OpenRecordset("APP")

    There is no table APP and you don't do anything with RSD2.

    4) Replace the two lines

    RSD1.Index = "COPE"
    RSD1.Seek "=", (COPE1)

    with

    RSD1.FindFirst "COPE=" & Chr(34) & COPE1 & Chr(34)

Posting Permissions

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