[AccessD] Open diff forms based on number

Hollis,Virginia HollisVJ at pgdp.usec.com
Sat Mar 22 08:50:01 CST 2003


Get the error:

The action or argument requires a FormName.

I made a table: tblDocumentTypes

TypeID: Autonumber
DocType: Z
FormName: frmServiceOrder

DocType: CPP
Formname: frmReview

Etc.

DoCmd.OpenForm DLookup("FormName", "tblDocumentTypes", DocType Like "'" &
[txtESO] & "*'")

It is not a continuos form, it is a form & subform (subform set to form).



-----Original Message-----
From: Stuart McLachlan [mailto:stuart at lexacorp.com.pg]
Sent: Saturday, March 22, 2003 8:27 AM
To: Hollis,Virginia; accessd at databaseadvisors.com
Subject: Re: [AccessD] Open diff forms based on number


et > I have a search form that I would like to show the actual record opened
in a
> separate form when the number is clicked. 
>  
> The only problem, the search results list different types of documents so
> clicking the number would require a different form to be opened based on
the
> number selected. The same type of documents begin with the same numbering
> scheme. For example, service orders all being with Z, Reviews begin with
> CPP, etc. Each type of document is different and has it's own screen
because
> they contain different data (so I can't use one screen for all results
when
> the number is clicked).
>  
> The only thing I can think to base the results on is the numbering scheme?
> If the number is like Z open service orders, if the number is Like CPP,
open
> the review form.
>  
> Really not sure how I can do this or if it can be done?
>  
> Virginia

Set up a key table

Z ; "frmServiceOrder"
CPP ; "frmReview"
etc

Assuming you are using a continuous form and the document number is in 
txtDocument:

Private Sub txtDocument_OnClick()

Docmd.Openform DLookup("FormName","tblDocumentTypes",DocType like '" & 
txtDocument & "*'"



-- 
Lexacorp Ltd
http://www.lexacorp.com.pg
Information Technology Consultancy, Software Development,System Support.





More information about the AccessD mailing list