[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 444
  • Last Modified:

Multiple criteria in "stLinkCriteria" statement

I have a form with 3 drop-down lists with the names, say, Control1, Control2, Control3.

Control 1 - numeric
Control 2 - text
Control 3 - memo

I am trying to make a button which opens up a form, Form1, based on what is selected in these three textboxes. Control1 will look up the values in Field1, Control2 the values in Field2...(all from a table, Table1, on which Form1 is based.)

However, there seem to be syntax errors in my VB stLinkCriteria statement.

I need the correct syntax to get the button to open Form1 with valid records based on the list box selections.

Thanks
0
yi_unt
Asked:
yi_unt
  • 5
  • 4
1 Solution
 
flavoCommented:
Try this..
stLinkCriteria = [Field1] = " & Me.Control1 & " and [Field2] = '" & Me.control2 & " and [field3] = '" & Me.control3 & "'"

Dave

0
 
yi_untAuthor Commented:
Dave,

The last single and double quotes get commented out by VB.
After removing those, I get the following error message on pressing the button to open the form:

---Microsoft Access can't find the field 'l' referred to in your expression.---

(It looks like the letter L in lowercase but is actully much bigger in lenght...I do not have anything like that in my statement!)

I tried manipulating your statement but it produces the same error.

Thanks
0
 
flavoCommented:
woops, missed a ' and " sorry

stLinkCriteria = "[Field1] = " & Me.Control1 & " and [Field2] = '" & Me.control2 & "' and [field3] = '" & Me.control3 & "'"
0
NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

 
yi_untAuthor Commented:
That works!

If it's not asking too much, could you show me the stLinkCriteria statement if I had just Field1(numeric) and Field2(text)?

(for 25 additional points?)

thanks.
0
 
flavoCommented:
stLinkCriteria = "[Field1] = " & Me.Control1 & " and [Field2] = '" & Me.control2 & "'"

Like that??
0
 
yi_untAuthor Commented:
If not, this answer is fine and I'll 'accept' it.

Kindly let me know. Thanks for your help
0
 
yi_untAuthor Commented:
I think I forgot to hit submit after adding the points.

Is there a way to reaward them?
0
 
flavoCommented:
Dont worry mate, its fine, i have plenty :-)

Glad its all working

Good luck eith your project!

Dave
0
 
yi_untAuthor Commented:
lol

thanks
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 5
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now