IF/THEN Syntax help !!!!! ....... Need assistance

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am updating an already existing DB written in Access 97, I am running into
a FORM issue that is probably easy to solve, I just am not proficient in
Access, can someone please help me with this issue.

I have a form and from this form I need to add a button to launch another
form, here's the issue. The form I want to launch with the button is
controlled by a one to one query that links a common field (Project_no). I
want the form to launch "Empty" and ready for Data Entry if the (Project_No)
is not found in the PROJECT TABLE within the query. If (Project_No) is
found in the PROJECT table, I want the form to launch with the requested
field information with the ability to add a record if necessary.

Can someone please provide me with "starter" syntax, I will most
appreciative and you can feel good about helping a totally illiterate access
user.

Thank You to anyone who can assist
 
If you filter the form in the OpenForm call's WHERE argument, it will show
the desired record. If the record doesn't exist and the form allows
additions (default) then you will get a blank form placed at a new record.

Example:
DoCmd.OpenForm "MyForm",,,"[Project_No]=" & Me.ProjectNumber
 
Wayne, First off THanks for your assistance

Secondly I have followups and I hope you can spare me a little more of your
time.

Questions

I have my subform properties set to Data Entry and Allow additions, but I
have been unable to add a button to the main for launching this form, I add
the AddNewRec command to the ON Click statement and I get "Can't go to
specified Record" when the sub is launched. Any Ideas? The Subform is
being controlled by a Query containing Two tables and No Relationships.
Also if I place the AddNewRec button right on the SubForm it gives me the
same message when I click it. Does this mean my query can't handle additions
to the tables ?

Please if you have time can you please type out the syntax for the On Open
and On click statements for the following

Main Form is "ProjectsDetail"
Sub Form is "Quotation"
Query Name QuotationQuery"
Common Field is "Project_no"

Wayne I don't know how to Thank You for your assistance already, anything
further is a bonus. Thank You very much

Wayne Morgan said:
If you filter the form in the OpenForm call's WHERE argument, it will show
the desired record. If the record doesn't exist and the form allows
additions (default) then you will get a blank form placed at a new record.

Example:
DoCmd.OpenForm "MyForm",,,"[Project_No]=" & Me.ProjectNumber

--
Wayne Morgan
MS Access MVP


MichaelBayne said:
I am updating an already existing DB written in Access 97, I am running
into
a FORM issue that is probably easy to solve, I just am not proficient in
Access, can someone please help me with this issue.

I have a form and from this form I need to add a button to launch another
form, here's the issue. The form I want to launch with the button is
controlled by a one to one query that links a common field (Project_no).
I
want the form to launch "Empty" and ready for Data Entry if the
(Project_No)
is not found in the PROJECT TABLE within the query. If (Project_No) is
found in the PROJECT table, I want the form to launch with the requested
field information with the ability to add a record if necessary.

Can someone please provide me with "starter" syntax, I will most
appreciative and you can feel good about helping a totally illiterate
access
user.

Thank You to anyone who can assist
 
Yes your query can't handel addition accross mutiple tables. A good way to
test to see if it will allow additions is to open the query and look at the
last line. if it allows additions then you are good to go, but if not then
the query is to complex or filtered to allow additions.
Good Luck!

MichaelBayne said:
Wayne, First off THanks for your assistance

Secondly I have followups and I hope you can spare me a little more of your
time.

Questions

I have my subform properties set to Data Entry and Allow additions, but I
have been unable to add a button to the main for launching this form, I add
the AddNewRec command to the ON Click statement and I get "Can't go to
specified Record" when the sub is launched. Any Ideas? The Subform is
being controlled by a Query containing Two tables and No Relationships.
Also if I place the AddNewRec button right on the SubForm it gives me the
same message when I click it. Does this mean my query can't handle additions
to the tables ?

Please if you have time can you please type out the syntax for the On Open
and On click statements for the following

Main Form is "ProjectsDetail"
Sub Form is "Quotation"
Query Name QuotationQuery"
Common Field is "Project_no"

Wayne I don't know how to Thank You for your assistance already, anything
further is a bonus. Thank You very much

Wayne Morgan said:
If you filter the form in the OpenForm call's WHERE argument, it will show
the desired record. If the record doesn't exist and the form allows
additions (default) then you will get a blank form placed at a new record.

Example:
DoCmd.OpenForm "MyForm",,,"[Project_No]=" & Me.ProjectNumber

--
Wayne Morgan
MS Access MVP


MichaelBayne said:
I am updating an already existing DB written in Access 97, I am running
into
a FORM issue that is probably easy to solve, I just am not proficient in
Access, can someone please help me with this issue.

I have a form and from this form I need to add a button to launch another
form, here's the issue. The form I want to launch with the button is
controlled by a one to one query that links a common field (Project_no).
I
want the form to launch "Empty" and ready for Data Entry if the
(Project_No)
is not found in the PROJECT TABLE within the query. If (Project_No) is
found in the PROJECT table, I want the form to launch with the requested
field information with the ability to add a record if necessary.

Can someone please provide me with "starter" syntax, I will most
appreciative and you can feel good about helping a totally illiterate
access
user.

Thank You to anyone who can assist
 
visdev1 is correct, open the query and see if it will accept additions. If
it won't, then the form based on the query won't either.

About the "subform", just a clarification. A subform is a form located on a
main form. If you are opening the form separately, it would be a pop-up or
secondary form. However, you may find that a subform may work better for
you. A subform will normally have a one-to-many relationship with the form
it is on. So, if the main (Parent) form has a client and you do jobs for the
client, the subform would have the multiple jobs for that client. The forms
would be linked on the ClientID field and the subform will automatically
follow the main form.
 
Back
Top