#Type! error on form

W

Wes

Hello,

Thanks in advance for any help.

I have a form on which I am trying to perform a dlookup for a date from a query. I am getting this error when I go to form view - #Type!. I confirmed that both field are date type fields, and neither are formatted to short date or any other format. Anyone know what might be causing this error?

Thank you
 
J

John W. Vinson

Hello,

Thanks in advance for any help.

I have a form on which I am trying to perform a dlookup for a date from a query. I am getting this error when I go to form view - #Type!. I confirmed that both field are date type fields, and neither are formatted to short date or any other format. Anyone know what might be causing this error?

Thank you

Not without seeing your code, no. Please post the actual text of your DLookUp
statement.

Are you using the # date delimiter around the criteria? That's essential if
it's a date literal.
--

John W. Vinson [MVP]
Microsoft's replacements for these newsgroups:
http://social.msdn.microsoft.com/Forums/en-US/accessdev/
http://social.answers.microsoft.com/Forums/en-US/addbuz/
and see also http://www.utteraccess.com
 
W

Wes

Thank you John. Here is the code:

=IIf([PurchaseOrder] Is Not Null,DLookUp("[PODate]","[qry_LinkedTableDetailsAll]","[WOHdrID] = #" & Forms!frmPO_WorkOrderView![ PurchaseOrderNumber] & "#"),"N/A")
 
J

John W. Vinson

Thank you John. Here is the code:

=IIf([PurchaseOrder] Is Not Null,DLookUp("[PODate]","[qry_LinkedTableDetailsAll]","[WOHdrID] = #" & Forms!frmPO_WorkOrderView![ PurchaseOrderNumber] & "#"),"N/A")

You've got two fieldnames - PurchaseOrder and PurchaseOrdernumber. Which is
which?

Is the field WOHdrId stored as a Date/Time field (as the # delimiter implies)?
That's a bit odd for an ID but possible.

And what is an example of the data actually stored in the textbox
PurchaseOrderNumber? Is it a valid mm/dd/yy or mm/dd/yyyy or yyyy-mm-dd Date?
Do you issue only one PO per day?

If - as I'm guessing - WOHdrID and PurchaseOrderNumber are Number datatype
fields, just lose the # delimiters (which are used only when searching
Date/Time fields). If they are Text fields replace the # with a singlequote '
character. If they are indeed dates, please explain.
--

John W. Vinson [MVP]
Microsoft's replacements for these newsgroups:
http://social.msdn.microsoft.com/Forums/en-US/accessdev/
http://social.answers.microsoft.com/Forums/en-US/addbuz/
and see also http://www.utteraccess.com
 
W

Wes

Thanks John. Since you replied, I'll keep going on this post.

WOHdrId is a long integer field and links to PurchaseOrderNumber.

We issue many POs per day. PurchaseOrderNumber is formatted as a long integer as well. The only actual date is PODate, and the format is mm/dd/yyyy.

Thanks again
 
J

John W. Vinson

Thanks John. Since you replied, I'll keep going on this post.

WOHdrId is a long integer field and links to PurchaseOrderNumber.

We issue many POs per day. PurchaseOrderNumber is formatted as a long integer as well. The only actual date is PODate, and the format is mm/dd/yyyy.

Thanks again

In that case:

=IIf([PurchaseOrder] Is Not
Null,DLookUp("[PODate]","[qry_LinkedTableDetailsAll]","[WOHdrID] = " &
Forms!frmPO_WorkOrderView![ PurchaseOrderNumber]),"N/A")

Since the PurchaseOrderNumber is not a date (you're just looking UP a date)
you do not need the # delimiters. Do note that if you're going to use this
expression AS a date in further calculations, your using "N/A" may break your
code - Access will coerce the expression to Text.
--

John W. Vinson [MVP]
Microsoft's replacements for these newsgroups:
http://social.msdn.microsoft.com/Forums/en-US/accessdev/
http://social.answers.microsoft.com/Forums/en-US/addbuz/
and see also http://www.utteraccess.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top