Using the Access button wizard to link forms

A

avarho

I am having a problem getting the button wizard to open the correct forms. I
have my main form (form 1) that is defined by a Unique Primary (ex. CaseID)
key and it is related in a one-to-many relationship to another form (form 2)
that has a primary key (StructureID) and a foreign key (CaseID). I want to be
able to add a button to form 1 (which displays data on only one record) that
will open form 2 to display only the records that corrospond to the CaseID in
Form 1.
Steps I've followed:
1. In design view on Form 1 I selected the button tool from the ribbon and
created a button on the form.
2. The botton wizard opens and asks what type of operations are to be
performed. I select FORM OPERATIONS and from the next menu I select OPEN FORM.
3. The next menu that appears is two radio button asking the user to select
the option to display all records or to display specific data. I select
DISPLAY SPECIFIC DATA.
4. The next box that appears asks the user to identify the field that
relate. I select CASEID from form 1 and CASEID from Form 2.
5. The next option are just naming the controls. After that it finishes the
wizard and the botton is created.

But my issues is after all of that my forms will not filter for the specific
data. When I select the button it will open a form that display all records
in the table.

How do I fix this?
 
D

Dale Fye

Copy the code that was created by the wizard and post it here.

Not that this really matters, but what version of Access are you using?

The line of code that opens your form, should look something like:

docmd.OpenForm "form2", , , "[CaseID] = " & me.[CaseID], , acDialog

if it is missing the criteria, it will just open the form as if you had
opened it from the database window.


--
HTH
Dale

Don''t forget to rate the post if it was helpful!

email address is invalid
Please reply to newsgroup only.
 
A

avarho

I am using Access 2007.

The code that is comes up is :
"[CaseNo]=" & [CaseNo]

Dale Fye said:
Copy the code that was created by the wizard and post it here.

Not that this really matters, but what version of Access are you using?

The line of code that opens your form, should look something like:

docmd.OpenForm "form2", , , "[CaseID] = " & me.[CaseID], , acDialog

if it is missing the criteria, it will just open the form as if you had
opened it from the database window.


--
HTH
Dale

Don''t forget to rate the post if it was helpful!

email address is invalid
Please reply to newsgroup only.



avarho said:
I am having a problem getting the button wizard to open the correct forms. I
have my main form (form 1) that is defined by a Unique Primary (ex. CaseID)
key and it is related in a one-to-many relationship to another form (form 2)
that has a primary key (StructureID) and a foreign key (CaseID). I want to be
able to add a button to form 1 (which displays data on only one record) that
will open form 2 to display only the records that corrospond to the CaseID in
Form 1.
Steps I've followed:
1. In design view on Form 1 I selected the button tool from the ribbon and
created a button on the form.
2. The botton wizard opens and asks what type of operations are to be
performed. I select FORM OPERATIONS and from the next menu I select OPEN FORM.
3. The next menu that appears is two radio button asking the user to select
the option to display all records or to display specific data. I select
DISPLAY SPECIFIC DATA.
4. The next box that appears asks the user to identify the field that
relate. I select CASEID from form 1 and CASEID from Form 2.
5. The next option are just naming the controls. After that it finishes the
wizard and the botton is created.

But my issues is after all of that my forms will not filter for the specific
data. When I select the button it will open a form that display all records
in the table.

How do I fix this?
 
D

Dale Fye

What is the data type of the [CaseNo] field (string, integer, long integer)?

If it is a string, then the "WHERE" argument of the Openform method should
read something like:

"[CaseNo] = " & chr$(34) & [CaseNo] & chr$(34)
or
"[CaseNo] = '" & [CaseNo] & "'"

What I was really looking for, is what is all the code in the click event of
the command button.
--
HTH
Dale

Don''t forget to rate the post if it was helpful!

email address is invalid
Please reply to newsgroup only.



avarho said:
I am using Access 2007.

The code that is comes up is :
"[CaseNo]=" & [CaseNo]

Dale Fye said:
Copy the code that was created by the wizard and post it here.

Not that this really matters, but what version of Access are you using?

The line of code that opens your form, should look something like:

docmd.OpenForm "form2", , , "[CaseID] = " & me.[CaseID], , acDialog

if it is missing the criteria, it will just open the form as if you had
opened it from the database window.


--
HTH
Dale

Don''t forget to rate the post if it was helpful!

email address is invalid
Please reply to newsgroup only.



avarho said:
I am having a problem getting the button wizard to open the correct forms. I
have my main form (form 1) that is defined by a Unique Primary (ex. CaseID)
key and it is related in a one-to-many relationship to another form (form 2)
that has a primary key (StructureID) and a foreign key (CaseID). I want to be
able to add a button to form 1 (which displays data on only one record) that
will open form 2 to display only the records that corrospond to the CaseID in
Form 1.
Steps I've followed:
1. In design view on Form 1 I selected the button tool from the ribbon and
created a button on the form.
2. The botton wizard opens and asks what type of operations are to be
performed. I select FORM OPERATIONS and from the next menu I select OPEN FORM.
3. The next menu that appears is two radio button asking the user to select
the option to display all records or to display specific data. I select
DISPLAY SPECIFIC DATA.
4. The next box that appears asks the user to identify the field that
relate. I select CASEID from form 1 and CASEID from Form 2.
5. The next option are just naming the controls. After that it finishes the
wizard and the botton is created.

But my issues is after all of that my forms will not filter for the specific
data. When I select the button it will open a form that display all records
in the table.

How do I fix this?
 
A

avarho

CaseID Datatype is a Long Integer.

It is identifed in the "on click" command as an embedded macro. The commands
in the macro is an openform command with the following instructions

Form Name: EntryForm-Structures
View: Form
Filter Name:
Where Condition: "[CaseNo]=" & [CaseNo]
Data Mode: Add
Window Mode: Normal


Dale Fye said:
What is the data type of the [CaseNo] field (string, integer, long integer)?

If it is a string, then the "WHERE" argument of the Openform method should
read something like:

"[CaseNo] = " & chr$(34) & [CaseNo] & chr$(34)
or
"[CaseNo] = '" & [CaseNo] & "'"

What I was really looking for, is what is all the code in the click event of
the command button.
--
HTH
Dale

Don''t forget to rate the post if it was helpful!

email address is invalid
Please reply to newsgroup only.



avarho said:
I am using Access 2007.

The code that is comes up is :
"[CaseNo]=" & [CaseNo]

Dale Fye said:
Copy the code that was created by the wizard and post it here.

Not that this really matters, but what version of Access are you using?

The line of code that opens your form, should look something like:

docmd.OpenForm "form2", , , "[CaseID] = " & me.[CaseID], , acDialog

if it is missing the criteria, it will just open the form as if you had
opened it from the database window.


--
HTH
Dale

Don''t forget to rate the post if it was helpful!

email address is invalid
Please reply to newsgroup only.



:

I am having a problem getting the button wizard to open the correct forms. I
have my main form (form 1) that is defined by a Unique Primary (ex. CaseID)
key and it is related in a one-to-many relationship to another form (form 2)
that has a primary key (StructureID) and a foreign key (CaseID). I want to be
able to add a button to form 1 (which displays data on only one record) that
will open form 2 to display only the records that corrospond to the CaseID in
Form 1.
Steps I've followed:
1. In design view on Form 1 I selected the button tool from the ribbon and
created a button on the form.
2. The botton wizard opens and asks what type of operations are to be
performed. I select FORM OPERATIONS and from the next menu I select OPEN FORM.
3. The next menu that appears is two radio button asking the user to select
the option to display all records or to display specific data. I select
DISPLAY SPECIFIC DATA.
4. The next box that appears asks the user to identify the field that
relate. I select CASEID from form 1 and CASEID from Form 2.
5. The next option are just naming the controls. After that it finishes the
wizard and the botton is created.

But my issues is after all of that my forms will not filter for the specific
data. When I select the button it will open a form that display all records
in the table.

How do I fix this?
 
D

Dale Fye

I don't use macros much, but try changing the Data Mode from Add to Edit.
--
HTH
Dale

Don''t forget to rate the post if it was helpful!

email address is invalid
Please reply to newsgroup only.



avarho said:
CaseID Datatype is a Long Integer.

It is identifed in the "on click" command as an embedded macro. The commands
in the macro is an openform command with the following instructions

Form Name: EntryForm-Structures
View: Form
Filter Name:
Where Condition: "[CaseNo]=" & [CaseNo]
Data Mode: Add
Window Mode: Normal


Dale Fye said:
What is the data type of the [CaseNo] field (string, integer, long integer)?

If it is a string, then the "WHERE" argument of the Openform method should
read something like:

"[CaseNo] = " & chr$(34) & [CaseNo] & chr$(34)
or
"[CaseNo] = '" & [CaseNo] & "'"

What I was really looking for, is what is all the code in the click event of
the command button.
--
HTH
Dale

Don''t forget to rate the post if it was helpful!

email address is invalid
Please reply to newsgroup only.



avarho said:
I am using Access 2007.

The code that is comes up is :
"[CaseNo]=" & [CaseNo]

:

Copy the code that was created by the wizard and post it here.

Not that this really matters, but what version of Access are you using?

The line of code that opens your form, should look something like:

docmd.OpenForm "form2", , , "[CaseID] = " & me.[CaseID], , acDialog

if it is missing the criteria, it will just open the form as if you had
opened it from the database window.


--
HTH
Dale

Don''t forget to rate the post if it was helpful!

email address is invalid
Please reply to newsgroup only.



:

I am having a problem getting the button wizard to open the correct forms. I
have my main form (form 1) that is defined by a Unique Primary (ex. CaseID)
key and it is related in a one-to-many relationship to another form (form 2)
that has a primary key (StructureID) and a foreign key (CaseID). I want to be
able to add a button to form 1 (which displays data on only one record) that
will open form 2 to display only the records that corrospond to the CaseID in
Form 1.
Steps I've followed:
1. In design view on Form 1 I selected the button tool from the ribbon and
created a button on the form.
2. The botton wizard opens and asks what type of operations are to be
performed. I select FORM OPERATIONS and from the next menu I select OPEN FORM.
3. The next menu that appears is two radio button asking the user to select
the option to display all records or to display specific data. I select
DISPLAY SPECIFIC DATA.
4. The next box that appears asks the user to identify the field that
relate. I select CASEID from form 1 and CASEID from Form 2.
5. The next option are just naming the controls. After that it finishes the
wizard and the botton is created.

But my issues is after all of that my forms will not filter for the specific
data. When I select the button it will open a form that display all records
in the table.

How do I fix this?
 
A

avarho

I tryed to change the data mode and it didn't fix the problem. Is there
anything else you can suggest?

Dale Fye said:
I don't use macros much, but try changing the Data Mode from Add to Edit.
--
HTH
Dale

Don''t forget to rate the post if it was helpful!

email address is invalid
Please reply to newsgroup only.



avarho said:
CaseID Datatype is a Long Integer.

It is identifed in the "on click" command as an embedded macro. The commands
in the macro is an openform command with the following instructions

Form Name: EntryForm-Structures
View: Form
Filter Name:
Where Condition: "[CaseNo]=" & [CaseNo]
Data Mode: Add
Window Mode: Normal


Dale Fye said:
What is the data type of the [CaseNo] field (string, integer, long integer)?

If it is a string, then the "WHERE" argument of the Openform method should
read something like:

"[CaseNo] = " & chr$(34) & [CaseNo] & chr$(34)
or
"[CaseNo] = '" & [CaseNo] & "'"

What I was really looking for, is what is all the code in the click event of
the command button.
--
HTH
Dale

Don''t forget to rate the post if it was helpful!

email address is invalid
Please reply to newsgroup only.



:

I am using Access 2007.

The code that is comes up is :
"[CaseNo]=" & [CaseNo]

:

Copy the code that was created by the wizard and post it here.

Not that this really matters, but what version of Access are you using?

The line of code that opens your form, should look something like:

docmd.OpenForm "form2", , , "[CaseID] = " & me.[CaseID], , acDialog

if it is missing the criteria, it will just open the form as if you had
opened it from the database window.


--
HTH
Dale

Don''t forget to rate the post if it was helpful!

email address is invalid
Please reply to newsgroup only.



:

I am having a problem getting the button wizard to open the correct forms. I
have my main form (form 1) that is defined by a Unique Primary (ex. CaseID)
key and it is related in a one-to-many relationship to another form (form 2)
that has a primary key (StructureID) and a foreign key (CaseID). I want to be
able to add a button to form 1 (which displays data on only one record) that
will open form 2 to display only the records that corrospond to the CaseID in
Form 1.
Steps I've followed:
1. In design view on Form 1 I selected the button tool from the ribbon and
created a button on the form.
2. The botton wizard opens and asks what type of operations are to be
performed. I select FORM OPERATIONS and from the next menu I select OPEN FORM.
3. The next menu that appears is two radio button asking the user to select
the option to display all records or to display specific data. I select
DISPLAY SPECIFIC DATA.
4. The next box that appears asks the user to identify the field that
relate. I select CASEID from form 1 and CASEID from Form 2.
5. The next option are just naming the controls. After that it finishes the
wizard and the botton is created.

But my issues is after all of that my forms will not filter for the specific
data. When I select the button it will open a form that display all records
in the table.

How do I fix this?
 

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