Type Mismatch

D

DS

I'm trying to open a form based on a Query, which then goes to a record
but I keep getting type mismath
Thanks
DS


DoCmd.OpenForm "MenuItems", , "MenuItemsQQ", , , "[MenuCatId] = " &
Me![List44].Column(1) & ""
 
K

Klatuu

Assuming [MenuCatId] is numeric, there is a syntax error:
DoCmd.OpenForm "MenuItems", , "MenuItemsQQ", , , "[MenuCatId] = " &
Me![List44].Column(1) & ""
Should be:
DoCmd.OpenForm "MenuItems", , "MenuItemsQQ", , , "[MenuCatId] = " &
Me![List44].Column(1)

If it is text then it should be:
DoCmd.OpenForm "MenuItems", , "MenuItemsQQ", , , "[MenuCatId] = '" &
Me![List44].Column(1) & "'"
 
J

Justin Hoffman

DS said:
I'm trying to open a form based on a Query, which then goes to a record
but I keep getting type mismath
Thanks
DS


DoCmd.OpenForm "MenuItems", , "MenuItemsQQ", , , "[MenuCatId] = " &
Me![List44].Column(1) & ""

As I have just put in another post, you should make sure you have a valid
MenuCatID before you move on. Dimension a variable for this and try and
explicitly convert the value to the right type. For example, first make
sure it is not a null value, then convert it to a long, perhaps also make
sure it isn't zero then finally build up the string.
 
D

DS

Klatuu said:
Assuming [MenuCatId] is numeric, there is a syntax error:
DoCmd.OpenForm "MenuItems", , "MenuItemsQQ", , , "[MenuCatId] = " &
Me![List44].Column(1) & ""
Should be:
DoCmd.OpenForm "MenuItems", , "MenuItemsQQ", , , "[MenuCatId] = " &
Me![List44].Column(1)

If it is text then it should be:
DoCmd.OpenForm "MenuItems", , "MenuItemsQQ", , , "[MenuCatId] = '" &
Me![List44].Column(1) & "'"

:

I'm trying to open a form based on a Query, which then goes to a record
but I keep getting type mismath
Thanks
DS


DoCmd.OpenForm "MenuItems", , "MenuItemsQQ", , , "[MenuCatId] = " &
Me![List44].Column(1) & ""
Problem solved. To many commas after MenuItemsQQ it should be one not
three.
Thanks
DS
 

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