Results 1 to 5 of 5

Thread: Error message

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Feb 2007
    Location
    Malaysia
    Posts
    1,370

    Error message

    Why I got this error message while trying to save the records?The field name "STATUS AIR" is a number data type
    When I debug, it highlight this line

    .Fields("STATUS AIR").Value = Text4.Text


    Code:
    With InfoRS
            .Fields("TAHUN").Value = Text1.Text
            .Fields("MUSIM").Value = Text2.Text
            .Fields("PLOT").Value = Text3.Text
            .Fields("STATUS AIR").Value = Text4.Text
            .Fields("PERINGKAT PADI").Value = Text5.Text
            .Fields("SIPUT GONDANG").Value = Combo1.Text
            .Fields("RACUN").Value = Combo2.Text
            .Fields("% RUMPAI").Value = Text8.Text
            .Fields("PERDU").Value = Text9.Text
            .Fields("BPH(NIM)").Value = Text10.Text
            .Fields("BPH(KPK PND)").Value = Text11.Text
            .Fields("BPH(KPK PNJ)").Value = Text12.Text
            .Fields("WBPH(NIM)").Value = Text13.Text
            .Fields("WBPH(DEWASA)").Value = Text14.Text
            .Fields("KBR").Value = Text15.Text
            .Fields("KES").Value = Text16.Text
            .Fields("NEZ").Value = Text17.Text
            .Fields("BH").Value = Text18.Text
            .Fields("THRIPS").Value = Text19.Text
            .Fields("UBG").Value = Text20.Text
            .Fields("ULD").Value = Text21.Text
            .Fields("UGD").Value = Text22.Text
            .Fields("URS").Value = Text23.Text
            .Fields("MSJ").Value = Text24.Text
            .Fields("TIKUS").Value = Text25.Text
            .Fields("HS").Value = Text26.Text
            .Fields("BLB").Value = Text27.Text
            .Fields("KRH").Value = Text28.Text
            .Fields("PMV").Value = Text29.Text
            .Fields("BAK").Value = Text30.Text
            .Fields("RT").Value = Text31.Text
            .Fields("RB").Value = Text32.Text
            .Fields("BTK PRG").Value = Text33.Text
            .Fields("RPS").Value = Text34.Text
            .Fields("E1").Value = Text35.Text
            .Fields("N1").Value = Text36.Text
            .Fields("E2").Value = Text37.Text
            .Fields("N2").Value = Text38.Text
            .Update
            End With
    Attached Images Attached Images  

  2. #2
    Frenzied Member MaximilianMayrhofer's Avatar
    Join Date
    Aug 2007
    Location
    IM IN YR LOOP
    Posts
    2,001

    Re: Error message

    You have basically answered your own question..

    vb.net Code:
    1. .Fields("STATUS AIR").Value = Text4.Text

    In this line, you are attempting to pass Text4.Text, which is a string, into a number, probably integer field. Use this to solve your problem:

    vb.net Code:
    1. .Fields("STATUS AIR").Value = CInt(Text4.Text)

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Feb 2007
    Location
    Malaysia
    Posts
    1,370

    Re: Error message

    I got another error if i let the textbox empty. The field name is number data type .

    .Fields("MUSIM").Value = CInt(Text2.Text)

  4. #4

    Thread Starter
    Frenzied Member
    Join Date
    Feb 2007
    Location
    Malaysia
    Posts
    1,370

    Re: Error message

    I got another error if one of the textbox is empty. All this field name are number data type (interger). How to sovle this so that I can save the record.
    With InfoRS

    .Fields("TAHUN").Value = Text1.Text
    .Fields("MUSIM").Value = Text2.Text
    .Fields("PLOT").Value = Text3.Text
    .Fields("STATUS AIR").Value = Text4.Text
    .Fields("PERINGKAT PADI").Value = Text5.Text
    .Fields("SIPUT GONDANG").Value = Combo1.Text
    .Fields("RACUN").Value = Combo2.Text
    .Fields("% RUMPAI").Value = Text8.Text
    .Fields("PERDU").Value = Text9.Text
    .Fields("BPH(NIM)").Value = Text10.Text
    .Fields("BPH(KPK PND)").Value = Text11.Text
    .Fields("BPH(KPK PNJ)").Value = Text12.Text
    .Fields("WBPH(NIM)").Value = Text13.Text
    .Fields("WBPH(DEWASA)").Value = Text14.Text
    .Fields("KBR").Value = Text15.Text
    .Fields("KES").Value = Text16.Text
    .Fields("NEZ").Value = Text17.Text
    .Fields("BH").Value = Text18.Text
    .Fields("THRIPS").Value = Text19.Text
    .Fields("UBG").Value = Text20.Text
    .Fields("ULD").Value = Text21.Text
    .Fields("UGD").Value = Text22.Text
    .Fields("URS").Value = Text23.Text
    .Fields("MSJ").Value = Text24.Text
    .Fields("TIKUS").Value = Text25.Text
    .Fields("HS").Value = Text26.Text
    .Fields("BLB").Value = Text27.Text
    .Fields("KRH").Value = Text28.Text
    .Fields("PMV").Value = Text29.Text
    .Fields("BAK").Value = Text30.Text
    .Fields("RT").Value = Text31.Text
    .Fields("RB").Value = Text32.Text
    .Fields("BTK PRG").Value = Text33.Text
    .Fields("RPS").Value = Text34.Text
    .Fields("E1").Value = Text35.Text
    .Fields("N1").Value = Text36.Text
    .Fields("E2").Value = Text37.Text
    .Fields("N2").Value = Text38.Text

    .Update
    End With



  5. #5
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Error message

    Then do
    Code:
    If Text4.Text <> vbNullString Then
       .Fields("STATUS AIR").Value = Text4.Text 
    End If

Posting Permissions

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



Click Here to Expand Forum to Full Width