The Value you entered isn't value for this field

Profector

Registered User.
Local time
Yesterday, 17:40
Joined
Mar 15, 2006
Messages
33
Hello All,

I'm trying to pass a agruement between subs, which seems to be working. For some reason I'm getting this message

Run-time error '-2473525967 (8002009)':

The Value you entered isn't value for this field


When I step through the lines, everything seems to be going well. I can see my agrument, varArgs, and it's right. It's something like "1-00001" or "1-00015"". Everything goes well till I get to "Me.fICAStartDate = !fICAStartDate" and then I get the above error message.


Anyone willing to take a look and see what i'm doing wrong? If I take out the two lines Me.fICAStartDate = !fICAStartDate and Me.txtICANumber = !fICANumber , the form open without errors.. but it's blank. It hasn't been filled in with the data from the table. :(


Here's the code:

Code:
Private Sub Form_Load()
   
    Dim varArgs
    Dim rst As New ADODB.Recordset
    
    'Grab that passed ID
    varArgs = Me.OpenArgs

    If Not IsNull(varArgs) Then
        With CurrentProject.Connection.Execute("SELECT * FROM fICA WHERE fICANumber = " & varArgs)
                Me.fICAStartDate = !fICAStartDate
                Me.txtICANumber = !fICANumber
            .Close
        End With
    End If
End Sub
 
Try:

Code:
    With CurrentProject.Connection.Execute("SELECT * FROM fICA WHERE fICANumber = " & Chr(34) & varArgs & Chr(34))


As an alternative, you could try:


Code:
  Me.fICAStartDate = Dlookup("fICAStartDate","fICA","fICANumber = & Chr(34) & varArgs & Chr(34))
  Me.txtICANumber = Dlookup("fICANumber","fICA","fICANumber = " & Chr(34) & varArgs & Chr(34))
 
Thanks for the help. It worked !!
 

Users who are viewing this thread

Back
Top Bottom