Open with Link Criteria and Columns in Datasheet

  • Follow


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*'
0
Reply Utf 2/22/2010 3:10:01 PM

Sash wrote:

>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*"

-- 
Marsh
MVP [MS Access]
0
Reply Marshall 2/22/2010 4:05:49 PM


1 Replies
663 Views

(page loaded in 0.058 seconds)


Reply: