Re: Open new form based on 2 fields.
From: Allen Browne (AllenBrowne_at_SeeSig.Invalid)
Date: 05/22/04
- Next message: Allen Browne: "Re: Need Help - Showing students age"
- Previous message: Allen Browne: "Re: Opening report from form"
- In reply to: Lurch: "Open new form based on 2 fields."
- Messages sorted by: [ date ] [ thread ]
Date: Sat, 22 May 2004 14:19:06 +0800
The strLinkCriteria has to end up looking like the WHERE clause of a query.
You can mock up a query using some literal values in the Criteria row, and
then switch to SQL View (View menu in query design) to see what the WHERE
clause looks like.
Text fields need quote marks around the literal value, and date fields need
to be delimited with #. Numeric fields do not have a delimiter, so you need
to use Nz() to supply some value; otherwise the resultant string will not
work if the field is null. (It is possible to use BuildCriteria to get these
if you desire.)
This example shows the kind of thing you need, showing a number field and a
text field:
strLinkCritiera = "([SomeNumberField] = " & Nz(Me.[SomeNumberField],0) & ")
AND ([SomeTextField] = """ & Me.[SomeTextField] & """)"
DoCmd.OpenForm "Form2", WhereCondition:=strLinkCriteria
-- Allen Browne - Microsoft MVP. Perth, Western Australia. Tips for Access users - http://allenbrowne.com/tips.html Reply to group, rather than allenbrowne at mvps dot org. "Lurch" <lurchun@spammedspammed.msn.com> wrote in message news:cNArc.97228$325.2127614@news20.bellglobal.com... > > I have a small problem. I have a form with a button that when I click it'll > open another form with just that record. I'm using the > strLinkCriteria....What is the proper syntax for doing the same thing but > with two fields being equal... > > Eg. > Location on form1 opens a only that record with the same location in form2. > How can I have Location and ZIP on form1 open the record in Form2 that > matches both Location and ZIP in form2...
- Next message: Allen Browne: "Re: Need Help - Showing students age"
- Previous message: Allen Browne: "Re: Opening report from form"
- In reply to: Lurch: "Open new form based on 2 fields."
- Messages sorted by: [ date ] [ thread ]