Results 1 to 8 of 8

Thread: Query help

  1. #1
    Join Date
    Mar 2004
    Posts
    79

    Unanswered: Query help

    What am I doing wrong? I have the following code. Me!FSCRate is a control on my form. When I debug, rsFSC!Rate has a value but it is not getting put into Me!FSCRate. Why?

    Dim rsFSC As New ADODB.Recordset
    Dim SQLStmt As String
    SQLStmt = "SELECT * FROM tblRates WHERE CustNumber = " & Forms![frmInvoice]![BillToNumber]
    rsFSC.Open SQLStmt, CurrentProject.Connection, adOpenDynamic, adLockOptimistic
    If Not rsFSC.EOF Then
    Me!FSCRate = rsFSC!FSCRate
    End If
    rsFSC.Close

  2. #2
    Join Date
    Jun 2004
    Location
    Florida, US
    Posts
    521
    you say it is rsFSC!Rate you want to assign but in the code it is spelled rsFSC!FSCRate. could this be the problem?
    ghozy.

  3. #3
    Join Date
    Mar 2004
    Posts
    79
    No, that was just me in a hurry in the text. I copy/pasted the code so the code is the way it is in my pgm.

  4. #4
    Join Date
    Jun 2004
    Location
    Florida, US
    Posts
    521
    is FSCRate also a fieldname in the form's recordsource? maybe Access trying to put it into the recordsource field, instead of the control? what hapens when you assign a constant value to me!FSCRate in the code? like:
    Me!FSCRate=123
    ?
    ghozy.

  5. #5
    Join Date
    Mar 2004
    Posts
    79
    Ok, It's getting closer. When I assigned 123, it worked...so I tried to assign .025 which is the rate that is supposed to be coming in, and that DIDN'T work so it's something with the decimal. I then said
    Me!FSCRate = .025 * 100 and 200.0000 is what displayed in my field. I then tried Me!FSCRate = rsRates!FSCRate * 100 and I get 200.00 (if I say * 1000, I get 2500) What I want is 2.5!!!


    The format is percent (and I know that acts wierd in Access).

  6. #6
    Join Date
    Jun 2004
    Location
    Florida, US
    Posts
    521
    make sure FSCRate field in your table is not long integer. it should be either double or currency field. if it is an integer field, it will round the percentage which is supposed to be after decimal.
    .5=50% etc.
    ghozy.

  7. #7
    Join Date
    Mar 2004
    Posts
    79
    Pure GENIUS!!! Thanks so much for your patience!!!!!

  8. #8
    Join Date
    Jun 2004
    Location
    Florida, US
    Posts
    521
    glad to help
    ghozy.

Posting Permissions

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