Forum Moderators: open

Message Too Old, No Replies

Form Re-use

How best avoid "Type mismatch"

         

HeadBut

10:37 pm on Oct 8, 2004 (gmt 0)

10+ Year Member



I want to re-use my form but I get the "type mismatch" error when I use:
<INPUT Type=Text" Name="RName" Value="<%=Recipe("RName")%>" size="25">

Is there a way to check if Recipe("RName") is defined without getting an error?

FYI: "Recipe" is from my access query when I am editing a record and does not exsist when creating a new record.

thanks
!

dotme

2:43 pm on Oct 9, 2004 (gmt 0)

10+ Year Member



I think *before* you get there, you might try defining your variable based on query results. The example below is simplified, since I'm not certain of your recordset name, etc.

If Recipe.BOF and Recipe.EOF = True Then
rvar = ""
Else
rvar = Recipe("RName")
End If

<INPUT Type=Text" Name="RName" Value="<% =rvar %>" size="25">

I'm guessing that you'll have a hidden tag somewhere in the form that tells the script you're posting to whether to UPDATE or INSERT?

Hope this helps