M
Michael Streeks
Hi,
I am trying to use the dlookup function in an event to
return the value of an id column where part of the value
in another column(same row) matches the value of a textbox.
The database is sequel with access front end.
The problem I seem to be having is that access basic feels
bad when I use %'s in my code. Depending on where i place
the delimiters I get several different errors. It also
seems that single quotes do not work at all where %'s are
on the same line.
this works:
ID = DLookup("[man_id]", "tblmanufact", "[man_name] = '" _
& Me!txtFindPart & "'")
this doesn't:
ID = DLookup("[man_id]", "[tblmanufact]", "[man_name] _
= ""%" & Me.txtFindPart.Value & "%""")
(Returns runtime error: "Invalid column name '%cdc%'."
where cdc is the value of me!txtfindpart
Another example(not dlookup, but i had %,' trouble):
works:
me.fiter = "([part_description] Like ""%" & _
Me!txtFindPart & "%"")"
works not:
me.filter = "([part_description] Like '"%" & _
Me!txtFindPart & "%"')"
I have been working with access for about a week and i'm
fairly certain i don't know what i'm doing. Any help will
be greatly appreciated.
Michael
I am trying to use the dlookup function in an event to
return the value of an id column where part of the value
in another column(same row) matches the value of a textbox.
The database is sequel with access front end.
The problem I seem to be having is that access basic feels
bad when I use %'s in my code. Depending on where i place
the delimiters I get several different errors. It also
seems that single quotes do not work at all where %'s are
on the same line.
this works:
ID = DLookup("[man_id]", "tblmanufact", "[man_name] = '" _
& Me!txtFindPart & "'")
this doesn't:
ID = DLookup("[man_id]", "[tblmanufact]", "[man_name] _
= ""%" & Me.txtFindPart.Value & "%""")
(Returns runtime error: "Invalid column name '%cdc%'."
where cdc is the value of me!txtfindpart
Another example(not dlookup, but i had %,' trouble):
works:
me.fiter = "([part_description] Like ""%" & _
Me!txtFindPart & "%"")"
works not:
me.filter = "([part_description] Like '"%" & _
Me!txtFindPart & "%"')"
I have been working with access for about a week and i'm
fairly certain i don't know what i'm doing. Any help will
be greatly appreciated.
Michael