Change Format

A

Andrew

Another Question from Andrew.

I have a table [Contracts] with a field [Contract_Number], text field, no
duplicates. This table is maintained by in house (Back end). Users of the
database (Front end) fill out routine data on forms which fill up several
tables. Queries are used to compile data for reports, most of which is the
same however depending on [Client] the format of the form must change. I have
designed several forms to meet their “Particular needsâ€. Is there a way to
fire off the info to the right form (using a print form button) based on
[Contract_Number] ?

Any help as always is greatly appreciated.
 
T

Tom van Stiphout

On Tue, 9 Feb 2010 16:44:06 -0800, Andrew

You're not giving enough information to answer that question. You say
that the form changes based on Client. Then you ask if given a
ContractNumber you can open the right form?
Logic dictates no, unless the ContractNumber has a code embedded that
reveals the Client, or unless given the ContractNumber we can lookup
the Client.
The latter seems somewhat likely. Perhaps you could write:
dim ClientID as Long
dim strFormName as string
ClientID = DLookup("ClientID", "Contracts", "Contract_Number=" &
ContractNumber)
select case ClientID
case 1
strFormName = "FormForClient1"
case 2
strFormName = "FormForClient2"
case else
strFormName = "FormForOtherClients"
end select
docmd.openform strFormName
(of course you have to change my object names to yours)

-Tom.
Microsoft Access MVP
 
A

Andrew

Sorry! It would be just as easy to refer to [client] as opposed to contract
number. The Contract Table has both [Contrcact_No] and [Client] as part of
its required data.
--
Andrew
H.W. Lochner


Tom van Stiphout said:
On Tue, 9 Feb 2010 16:44:06 -0800, Andrew

You're not giving enough information to answer that question. You say
that the form changes based on Client. Then you ask if given a
ContractNumber you can open the right form?
Logic dictates no, unless the ContractNumber has a code embedded that
reveals the Client, or unless given the ContractNumber we can lookup
the Client.
The latter seems somewhat likely. Perhaps you could write:
dim ClientID as Long
dim strFormName as string
ClientID = DLookup("ClientID", "Contracts", "Contract_Number=" &
ContractNumber)
select case ClientID
case 1
strFormName = "FormForClient1"
case 2
strFormName = "FormForClient2"
case else
strFormName = "FormForOtherClients"
end select
docmd.openform strFormName
(of course you have to change my object names to yours)

-Tom.
Microsoft Access MVP


Another Question from Andrew.

I have a table [Contracts] with a field [Contract_Number], text field, no
duplicates. This table is maintained by in house (Back end). Users of the
database (Front end) fill out routine data on forms which fill up several
tables. Queries are used to compile data for reports, most of which is the
same however depending on [Client] the format of the form must change. I have
designed several forms to meet their “Particular needsâ€. Is there a way to
fire off the info to the right form (using a print form button) based on
[Contract_Number] ?

Any help as always is greatly appreciated.
.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top