Type Mismatch

  • Thread starter Thread starter DS
  • Start date Start date
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) & ""
 
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) & "'"
 
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.
 
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
 
Back
Top