Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Understanding a "Where" Statement

Status
Not open for further replies.

philliplaw

IS-IT--Management
May 4, 2011
6
0
0
US
I have combobox with a list of customers. Once a customer is selected, I have a button to allow the user to edit the customer's infomation. The button launches a form with a "Where" statement.

Where Condition = ="[Customer].[CustID]=" & [cboCustID]

This works perfectly, but I do not understand some of the items (copied from a sample file).

Why are there two "=" signs after Where Condition?
Why is [Customer].[CustID]= in quotes?
What is the & sign for?

Thank you.
 
Where are you seeing
philliplaw said:
Where Condition = ="[Customer].[CustID]=" & [cboCustID]
Please copy and paste exact code and provide some additional context.
I would expect the actual code to be something like:
Code:
DoCmd.OpenForm "frmNameHere", WhereCondition:="CustID = " & Me.cboCustID
The WhereCondition argument populates the Filter property of the form as it opens. This assumes the CustID is numeric.

Duane
Hook'D on Access
MS Access MVP
 
This is a Macro:

If [cboCustID] Is Not Null
Then
OpenForm New Customer
Where Condition = ="[Customer].[CustID]=" & [cboCustID]
 
== is a comparator and just means =
just as <= means less than or equal to,
>= means greater than or equal to and
!= or <> means not equal to

I am surprised it is being use in the macro as I thought it was normally associated with java or c++

an 'end if' also seems to be missing from the end of the routine and the 'is not null' statement is incorrect and should be
not isnull ()

are you sure this is a vba macro?

Ian Mayor (UK)
Program Error
9 times out of 10 I know what I'm talking about. This must be my tenth reply.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top