Open with Link Criteria and Columns in Datasheet

S

Sash

I have two questions. First, how do you order columns in a datasheet view?
I tried to order them in the query and on the form, but neither seem to
change the column order.

Next, I'm trying to open a form "frm_CSearch" where the data in the field
"Search" is LIKE whatever is keyed in on the form "MainSearchText". Below is
what I thought would work:

Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frm_CSearch"

stLinkCriteria = "[Search] like *" & Me!MainSearchText & "*"
DoCmd.OpenForm stDocName, , , stLinkCriteria

My error is syntax error (missing operator) in query expression '[Search]
like *mesh*'
 
M

Marshall Barton

Sash said:
I have two questions. First, how do you order columns in a datasheet view?
I tried to order them in the query and on the form, but neither seem to
change the column order.

Next, I'm trying to open a form "frm_CSearch" where the data in the field
"Search" is LIKE whatever is keyed in on the form "MainSearchText". Below is
what I thought would work:

Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frm_CSearch"

stLinkCriteria = "[Search] like *" & Me!MainSearchText & "*"
DoCmd.OpenForm stDocName, , , stLinkCriteria

My error is syntax error (missing operator) in query expression '[Search]
like *mesh*'


The pattern operand needs to be in quotes:

stLinkCriteria = "[Search] like ""*" & Me!MainSearchText &
"*"""

so the where condition ends up looking like:

[Search] Like "*mesh*"
 

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