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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

i want to add more data to a form

Status
Not open for further replies.

tazibc

Instructor
Oct 5, 2007
66
GB
pls help I have created a login form which opens up another form teh code looks like this:-

ElseIf strUser = "user4" And Password = "user4" Then
MsgBox "Access Granted"
DoCmd.Close
DoCmd.OpenForm "Manchester", , , "[Service Centre / Satellite] = 'Manchester'", , , strUser

can any one tell me if there is a way I can add more service centers i.e when the user puts in the username and pword it will give them information for manchester,chester,nwales, penrith and preston.

how would the above service centers get incorportated into the code above have tried everything but i am new to access pls help.
 
How about using OR?
Code:
DoCmd.OpenForm "Manchester", , , "[Service Centre / Satellite] = 'Manchester' OR [Service Centre / Satellite] ='Chester'", , , strUser
Hope this helps

HarleyQuinn
---------------------------------
Carter, hand me my thinking grenades!

You can hang outside in the sun all day tossing a ball around, or you can sit at your computer and do something that matters. - Eric Cartman

Get the most out of Tek-Tips, read FAQ222-2244: How to get the best answers before posting.

 
Thanks Harley,

but what if i wanted the form to show information for manchester and chester and penrith all together would I replace the OR statement with AND?
 
so would my code look like this???

DoCmd.OpenForm "Manchester", , , "[Service Centre / Satellite] = 'Manchester' and [Service Centre / Satellite] ='Chester'and [Service Centre / Satellite] ='nwales'and [Service Centre / Satellite] ='penrith", , , strUser

so in essence the form will open manchester form but the records will be of the following sites manchester, nwales etc as in the code...
 
No, because [Service Centre / Satellite] won't be 'Manchester' AND 'Chester' AND 'Penrith' for a single record, it will be one of the three, so if you use OR it will show records that are any of those three.

HarleyQuinn
---------------------------------
Carter, hand me my thinking grenades!

You can hang outside in the sun all day tossing a ball around, or you can sit at your computer and do something that matters. - Eric Cartman

Get the most out of Tek-Tips, read FAQ222-2244: How to get the best answers before posting.

 
I'd use something like this:
Code:
DoCmd.OpenForm "Manchester", , , "[Service Centre / Satellite] In ('Manchester','Chester','nwales','penrith')", , , strUser

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top