Open Form

  • Thread starter Thread starter Bernd Smits
  • Start date Start date
B

Bernd Smits

Hi,
So:
1) I create a combobox bound to a column in a table;
2) I create a form that contains all the fields that are present in the same
table;
3) But finally do I have to add the commandline you've wrote? And last part
of the commandline is Me.cboPerson or do I have to replace it with something
else?
Thanks
Bernd

Hi,
First, usually you have the PersonId field (or whatever you called it) as
the bound column
of your combo.
Now, you design a form that pulls ALL the records.
You then use the OpenForm method utilizing the WhereCondition argument to
only display the info on the selected person:

DoCmd.OpenForm "yourForm",,,"PersonId = & Me.cboPerson

Substitute your form, control and field names.
 
Hi,
So:
1) I create a combobox bound to a column in a table;
2) I create a form that contains all the fields that are present in the same
table;
3) But finally do I have to add the commandline you've wrote? And last part
of the commandline is Me.cboPerson or do I have to replace it with something
else?
Thanks
Bernd

Hi,
First, usually you have the PersonId field (or whatever you called it) as
the bound column
of your combo.
Now, you design a form that pulls ALL the records.
You then use the OpenForm method utilizing the WhereCondition argument to
only display the info on the selected person:

DoCmd.OpenForm "yourForm",,,"PersonId = & Me.cboPerson

Substitute your form, control and field names.

As you have started a new thread with this message, I can only guess
you wish to open a form filtered to the record whose ID matches the
value in the combo box.

As written there is a missing quote in the suggested Where clause.
The entire line should read:
DoCmd.OpenForm "yourForm",,,"[PersonId] = " & Me![cboPerson]

Change "yourForm" to the actual name of the form you wish to open.
Change "cboPerson" to the actual name of the combo box.
Change "PersonID" to the actual name of the Unique prime key field in
the table of the form being opened.

The above assumes [PersonID] is a number datatype field.
If [PersonID] is Text datatype, use:

DoCmd.OpenForm "yourForm",,,"[PersonId] = '" & Me![cboPerson] & "'"
 
Hi,
So:
1) I create a combobox bound to a column in a table;
2) I create a form that contains all the fields that are present in the same
table;
3) But finally do I have to add the commandline you've wrote? And last part
of the commandline is Me.cboPerson or do I have to replace it with something
else?
Thanks
Bernd

Hi,
First, usually you have the PersonId field (or whatever you called it) as
the bound column
of your combo.
Now, you design a form that pulls ALL the records.
You then use the OpenForm method utilizing the WhereCondition argument to
only display the info on the selected person:

DoCmd.OpenForm "yourForm",,,"PersonId = & Me.cboPerson

Substitute your form, control and field names.

As you have started a new thread with this message, I can only guess
you wish to open a form filtered to the record whose ID matches the
value in the combo box.

As written there is a missing quote in the suggested Where clause.
The entire line should read:
DoCmd.OpenForm "yourForm",,,"[PersonId] = " & Me![cboPerson]

Change "yourForm" to the actual name of the form you wish to open.
Change "cboPerson" to the actual name of the combo box.
Change "PersonID" to the actual name of the Unique prime key field in
the table of the form being opened.

The above assumes [PersonID] is a number datatype field.
If [PersonID] is Text datatype, use:

DoCmd.OpenForm "yourForm",,,"[PersonId] = '" & Me![cboPerson] & "'"

I forgot to add, you would write the OpenForm command in the either
the cboPerson AfterUpdate event or in a Command button Click event.
 
Hi,
my question is now: where do I have to insert the command 'DoCmd.OpenForm
"yourForm",,,"[PersonId] = " & Me![cboPerson]'
exactly?
Thanks
Bernd

fredg said:
Hi,
So:
1) I create a combobox bound to a column in a table;
2) I create a form that contains all the fields that are present in the same
table;
3) But finally do I have to add the commandline you've wrote? And last part
of the commandline is Me.cboPerson or do I have to replace it with something
else?
Thanks
Bernd

Hi,
First, usually you have the PersonId field (or whatever you called it) as
the bound column
of your combo.
Now, you design a form that pulls ALL the records.
You then use the OpenForm method utilizing the WhereCondition argument to
only display the info on the selected person:

DoCmd.OpenForm "yourForm",,,"PersonId = & Me.cboPerson

Substitute your form, control and field names.

As you have started a new thread with this message, I can only guess
you wish to open a form filtered to the record whose ID matches the
value in the combo box.

As written there is a missing quote in the suggested Where clause.
The entire line should read:
DoCmd.OpenForm "yourForm",,,"[PersonId] = " & Me![cboPerson]

Change "yourForm" to the actual name of the form you wish to open.
Change "cboPerson" to the actual name of the combo box.
Change "PersonID" to the actual name of the Unique prime key field in
the table of the form being opened.

The above assumes [PersonID] is a number datatype field.
If [PersonID] is Text datatype, use:

DoCmd.OpenForm "yourForm",,,"[PersonId] = '" & Me![cboPerson] & "'"
 
Hi,
my question is now: where do I have to insert the command 'DoCmd.OpenForm
"yourForm",,,"[PersonId] = " & Me![cboPerson]'
exactly?
Thanks
Bernd

fredg said:
Hi,
So:
1) I create a combobox bound to a column in a table;
2) I create a form that contains all the fields that are present in the same
table;
3) But finally do I have to add the commandline you've wrote? And last part
of the commandline is Me.cboPerson or do I have to replace it with something
else?
Thanks
Bernd

Hi,
First, usually you have the PersonId field (or whatever you called it) as
the bound column
of your combo.
Now, you design a form that pulls ALL the records.
You then use the OpenForm method utilizing the WhereCondition argument to
only display the info on the selected person:

DoCmd.OpenForm "yourForm",,,"PersonId = & Me.cboPerson

Substitute your form, control and field names.

As you have started a new thread with this message, I can only guess
you wish to open a form filtered to the record whose ID matches the
value in the combo box.

As written there is a missing quote in the suggested Where clause.
The entire line should read:
DoCmd.OpenForm "yourForm",,,"[PersonId] = " & Me![cboPerson]

Change "yourForm" to the actual name of the form you wish to open.
Change "cboPerson" to the actual name of the combo box.
Change "PersonID" to the actual name of the Unique prime key field in
the table of the form being opened.

The above assumes [PersonID] is a number datatype field.
If [PersonID] is Text datatype, use:

DoCmd.OpenForm "yourForm",,,"[PersonId] = '" & Me![cboPerson] & "'"

I answered this in a follow-up to my post.

"I forgot to add, you would write the OpenForm command in the either
the cboPerson AfterUpdate event or in a Command button Click event."
 
Hi,
ok I done it. But I have still a few questions:
1) I would like to double-click before the relative for is open, but now the
form opens directly just when I click one time. How to do?;
2) I would like that the form opens on the same form as the combobox,
exactly I want that the form opens below the combobox. How can I do that?
With the clause "where"?
3) I would like that when I'm writing (first, second, etc. letter) of the
name of the person that I'm searching about, there opens below the combobox,
istantly a list of the names that begins with letter that I have typed. How
can I do that?.
Thanks
Bernd
fredg said:
Hi,
my question is now: where do I have to insert the command 'DoCmd.OpenForm
"yourForm",,,"[PersonId] = " & Me![cboPerson]'
exactly?
Thanks
Bernd

fredg said:
On Tue, 7 Sep 2004 22:37:14 +0200, Bernd Smits wrote:

Hi,
So:
1) I create a combobox bound to a column in a table;
2) I create a form that contains all the fields that are present in
the
same
table;
3) But finally do I have to add the commandline you've wrote? And last part
of the commandline is Me.cboPerson or do I have to replace it with something
else?
Thanks
Bernd

Hi,
First, usually you have the PersonId field (or whatever you called it) as
the bound column
of your combo.
Now, you design a form that pulls ALL the records.
You then use the OpenForm method utilizing the WhereCondition argument to
only display the info on the selected person:

DoCmd.OpenForm "yourForm",,,"PersonId = & Me.cboPerson

Substitute your form, control and field names.

As you have started a new thread with this message, I can only guess
you wish to open a form filtered to the record whose ID matches the
value in the combo box.

As written there is a missing quote in the suggested Where clause.
The entire line should read:
DoCmd.OpenForm "yourForm",,,"[PersonId] = " & Me![cboPerson]

Change "yourForm" to the actual name of the form you wish to open.
Change "cboPerson" to the actual name of the combo box.
Change "PersonID" to the actual name of the Unique prime key field in
the table of the form being opened.

The above assumes [PersonID] is a number datatype field.
If [PersonID] is Text datatype, use:

DoCmd.OpenForm "yourForm",,,"[PersonId] = '" & Me![cboPerson] & "'"

I answered this in a follow-up to my post.

"I forgot to add, you would write the OpenForm command in the either
the cboPerson AfterUpdate event or in a Command button Click event."
 
Hi,
ok I done it. But I have still a few questions:
1) I would like to double-click before the relative for is open, but now the
form opens directly just when I click one time. How to do?;

If you wish the form to open on double-clicking the combo box, then
place the code to open the form in the Combo Box's Double-click event,
not the click event.
2) I would like that the form opens on the same form as the combobox,
exactly I want that the form opens below the combobox. How can I do that?
With the clause "where"?

You could pass the opening position to the form using the OpenForm
OpenArgs argument:

DoCmd.OpenForm "FormName", , , , , , Me!ComboName.Left & "," &
Me.ComboName.Top + Me!ComboName.Height + Me.FormHeader.Height + 1440

You'll need to adjust the above, depending upon if you have a form
header and exactly where you wish the form to open.
Note: The measurements are in Twips; 1440 Twips = 1 inch.

Then code the Load event of the form being opened:

If Not IsNull(Me.OpenArgs) Then
DoCmd.MoveSize Left(Me.OpenArgs, InStr(Me.OpenArgs, ",") - 1),
Mid(Me.OpenArgs, InStr(Me.OpenArgs, ",") + 1)
End If

You'll also want to set this form's PopUp property to Yes.
3) I would like that when I'm writing (first, second, etc. letter) of the
name of the person that I'm searching about, there opens below the combobox,
istantly a list of the names that begins with letter that I have typed. How
can I do that?.

I'm not wholly sure of what you want here.
The above is normal combo box behavior if you set the combo AutoExpand
property to Yes.
Or do you also wish to set the combo box to dropdown on enter. In that
case, code the Combo Box Enter event:
Me!ComboName.Dropdown

Thanks
Bernd
fredg said:
Hi,
my question is now: where do I have to insert the command 'DoCmd.OpenForm
"yourForm",,,"[PersonId] = " & Me![cboPerson]'
exactly?
Thanks
Bernd

"fredg" <[email protected]> ha scritto nel messaggio
On Tue, 7 Sep 2004 22:37:14 +0200, Bernd Smits wrote:

Hi,
So:
1) I create a combobox bound to a column in a table;
2) I create a form that contains all the fields that are present in the
same
table;
3) But finally do I have to add the commandline you've wrote? And last
part
of the commandline is Me.cboPerson or do I have to replace it with
something
else?
Thanks
Bernd

Hi,
First, usually you have the PersonId field (or whatever you called it)
as
the bound column
of your combo.
Now, you design a form that pulls ALL the records.
You then use the OpenForm method utilizing the WhereCondition argument
to
only display the info on the selected person:

DoCmd.OpenForm "yourForm",,,"PersonId = & Me.cboPerson

Substitute your form, control and field names.

As you have started a new thread with this message, I can only guess
you wish to open a form filtered to the record whose ID matches the
value in the combo box.

As written there is a missing quote in the suggested Where clause.
The entire line should read:
DoCmd.OpenForm "yourForm",,,"[PersonId] = " & Me![cboPerson]

Change "yourForm" to the actual name of the form you wish to open.
Change "cboPerson" to the actual name of the combo box.
Change "PersonID" to the actual name of the Unique prime key field in
the table of the form being opened.

The above assumes [PersonID] is a number datatype field.
If [PersonID] is Text datatype, use:

DoCmd.OpenForm "yourForm",,,"[PersonId] = '" & Me![cboPerson] & "'"

I answered this in a follow-up to my post.

"I forgot to add, you would write the OpenForm command in the either
the cboPerson AfterUpdate event or in a Command button Click event."
 
Back
Top