Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2004
    Posts
    13

    Unanswered: "Invalid use of Null" error

    I have a field displayed in a form. When I double click it, I need it to look up the value in another table to lookup the exchange rate...

    ER and currency ID are numeric feilds

    my code is

    Private Sub ER_DblClick(Cancel As Integer)
    'Insert RateEur

    Dim sEUR As String
    Dim Rec5 As Recordset
    Dim db5 As Database



    sEUR = "SELECT DISTINCT ER FROM tblCurrency"
    sEUR = sEUR & "WHERE currencyID = 1 "
    MsgBox ER


    Set db5 = CurrentDb
    Set Rec5 = db5.OpenRecordset(sEUR)



    If Rec5.RecordCount > 0 Then
    ER = Rec5.Fields("ER")

    End If
    End Sub


    Can anyoen help,
    thanks

    Allen

  2. #2
    Join Date
    Jan 2004
    Posts
    13

    Re: "Invalid use of Null" error

    [QUOTE][SIZE=1]Originally posted by awedmondson
    Sorry, the error is on

    MsgBox ER

  3. #3
    Join Date
    Jun 2003
    Location
    Belgium
    Posts
    133
    You can't call ER to a messagebox if you have not put a value in it yet.

    But you can solve your problem much easier. Try this code :

    Private Sub ER_DblClick(Cancel As Integer)
    'Insert RateEur
    me!ER = DLookup("ER", "tblCurrency", "currencyID=1")
    End Sub

    This should do the trick....

  4. #4
    Join Date
    Jan 2004
    Posts
    13

    Thank you Herman,

    Thank you Herman,

    That was much easier.
    very much appricated

    regards
    Allen

Posting Permissions

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