Making a list of all persons in a table in a corresponding form.

J

Jo Gjessing

Hi all,

In a database of mine I have a table containing persons' name, address and
so on. In the corresponding form I have of course all the fields where the
users put in the data. In this form I want to have a list showing all the
persons in the table as well, so that the users can click the right person in
the list and have his or her data filled into the fields. I have tried to
make a table form from the same table and include it as a subform. This,
however, was not successful because the subform only showed the person in
focus in the form, not all the persons in the table. Also, I do not think it
would be possible to click a person in the subform and get the data filled
into the fields, even if I a got all the persons in the table.

If you have a good idea how to make this, please let me know.

Thank you very much in advance.

Jo
 
M

Mark A. Sam

Jo,

You don't need another table. You need a unbound listbox or unbound
combobox with rowsource being populated from the table where your employee
info resides. In the AfterUpdate event fill in the "fields" by addressing
the columns on the listbox or textbox like this:

[EmpFirstName] = [cboEmployee}.Column(0)
[EmpLastNamr]= [cboEmployee}.Column(1)

Etc.

God Bless,

Mark A. Sam
 
K

Klatuu

Mark,
Your suggestion will not move to the record, it will overwrite what is in
the current record. The normal way to do this is the use the unmbound
combo's After Update event to reposition to the selected record. The combo's
Bound Column should contain the primary key or a unique field in the table.
You can use other columns to display than may be more user friendly.

Private Sub MyCombo_AfterUpdate()

With Me.RecordsetClone
.FindFirst "[TableKeyField] = " & Me.MyCombo
If Not .Nomatch Then
Me.Bookmark = .Bookmark
End If
End With

End Sub
--
Dave Hargis, Microsoft Access MVP


Mark A. Sam said:
Jo,

You don't need another table. You need a unbound listbox or unbound
combobox with rowsource being populated from the table where your employee
info resides. In the AfterUpdate event fill in the "fields" by addressing
the columns on the listbox or textbox like this:

[EmpFirstName] = [cboEmployee}.Column(0)
[EmpLastNamr]= [cboEmployee}.Column(1)

Etc.

God Bless,

Mark A. Sam



Jo Gjessing said:
Hi all,

In a database of mine I have a table containing persons' name, address and
so on. In the corresponding form I have of course all the fields where the
users put in the data. In this form I want to have a list showing all the
persons in the table as well, so that the users can click the right person
in
the list and have his or her data filled into the fields. I have tried to
make a table form from the same table and include it as a subform. This,
however, was not successful because the subform only showed the person in
focus in the form, not all the persons in the table. Also, I do not think
it
would be possible to click a person in the subform and get the data
filled
into the fields, even if I a got all the persons in the table.

If you have a good idea how to make this, please let me know.

Thank you very much in advance.

Jo
 
M

Mark A. Sam

Dave.

I didn't see that she wanted to go to another record. I think he/she was
just looking to populate the fields.

God Bless,

Mark

Klatuu said:
Mark,
Your suggestion will not move to the record, it will overwrite what is in
the current record. The normal way to do this is the use the unmbound
combo's After Update event to reposition to the selected record. The
combo's
Bound Column should contain the primary key or a unique field in the
table.
You can use other columns to display than may be more user friendly.

Private Sub MyCombo_AfterUpdate()

With Me.RecordsetClone
.FindFirst "[TableKeyField] = " & Me.MyCombo
If Not .Nomatch Then
Me.Bookmark = .Bookmark
End If
End With

End Sub
--
Dave Hargis, Microsoft Access MVP


Mark A. Sam said:
Jo,

You don't need another table. You need a unbound listbox or unbound
combobox with rowsource being populated from the table where your
employee
info resides. In the AfterUpdate event fill in the "fields" by
addressing
the columns on the listbox or textbox like this:

[EmpFirstName] = [cboEmployee}.Column(0)
[EmpLastNamr]= [cboEmployee}.Column(1)

Etc.

God Bless,

Mark A. Sam



Jo Gjessing said:
Hi all,

In a database of mine I have a table containing persons' name, address
and
so on. In the corresponding form I have of course all the fields where
the
users put in the data. In this form I want to have a list showing all
the
persons in the table as well, so that the users can click the right
person
in
the list and have his or her data filled into the fields. I have tried
to
make a table form from the same table and include it as a subform.
This,
however, was not successful because the subform only showed the person
in
focus in the form, not all the persons in the table. Also, I do not
think
it
would be possible to click a person in the subform and get the data
filled
into the fields, even if I a got all the persons in the table.

If you have a good idea how to make this, please let me know.

Thank you very much in advance.

Jo
 
K

Klatuu

If that is what the OP wants, then your solution is correct. I read it
differently.
--
Dave Hargis, Microsoft Access MVP


Mark A. Sam said:
Dave.

I didn't see that she wanted to go to another record. I think he/she was
just looking to populate the fields.

God Bless,

Mark

Klatuu said:
Mark,
Your suggestion will not move to the record, it will overwrite what is in
the current record. The normal way to do this is the use the unmbound
combo's After Update event to reposition to the selected record. The
combo's
Bound Column should contain the primary key or a unique field in the
table.
You can use other columns to display than may be more user friendly.

Private Sub MyCombo_AfterUpdate()

With Me.RecordsetClone
.FindFirst "[TableKeyField] = " & Me.MyCombo
If Not .Nomatch Then
Me.Bookmark = .Bookmark
End If
End With

End Sub
--
Dave Hargis, Microsoft Access MVP


Mark A. Sam said:
Jo,

You don't need another table. You need a unbound listbox or unbound
combobox with rowsource being populated from the table where your
employee
info resides. In the AfterUpdate event fill in the "fields" by
addressing
the columns on the listbox or textbox like this:

[EmpFirstName] = [cboEmployee}.Column(0)
[EmpLastNamr]= [cboEmployee}.Column(1)

Etc.

God Bless,

Mark A. Sam



Hi all,

In a database of mine I have a table containing persons' name, address
and
so on. In the corresponding form I have of course all the fields where
the
users put in the data. In this form I want to have a list showing all
the
persons in the table as well, so that the users can click the right
person
in
the list and have his or her data filled into the fields. I have tried
to
make a table form from the same table and include it as a subform.
This,
however, was not successful because the subform only showed the person
in
focus in the form, not all the persons in the table. Also, I do not
think
it
would be possible to click a person in the subform and get the data
filled
into the fields, even if I a got all the persons in the table.

If you have a good idea how to make this, please let me know.

Thank you very much in advance.

Jo
 
J

Jo Gjessing

Thank you very much, both of you. Dave read my unsuccessful English as I
meant it. I shall therefore try your solution, Dave, and I am looking forward
to see how it works. Thank you again.

Klatuu skrev:
If that is what the OP wants, then your solution is correct. I read it
differently.
--
Dave Hargis, Microsoft Access MVP


Mark A. Sam said:
Dave.

I didn't see that she wanted to go to another record. I think he/she was
just looking to populate the fields.

God Bless,

Mark

Klatuu said:
Mark,
Your suggestion will not move to the record, it will overwrite what is in
the current record. The normal way to do this is the use the unmbound
combo's After Update event to reposition to the selected record. The
combo's
Bound Column should contain the primary key or a unique field in the
table.
You can use other columns to display than may be more user friendly.

Private Sub MyCombo_AfterUpdate()

With Me.RecordsetClone
.FindFirst "[TableKeyField] = " & Me.MyCombo
If Not .Nomatch Then
Me.Bookmark = .Bookmark
End If
End With

End Sub
--
Dave Hargis, Microsoft Access MVP


:

Jo,

You don't need another table. You need a unbound listbox or unbound
combobox with rowsource being populated from the table where your
employee
info resides. In the AfterUpdate event fill in the "fields" by
addressing
the columns on the listbox or textbox like this:

[EmpFirstName] = [cboEmployee}.Column(0)
[EmpLastNamr]= [cboEmployee}.Column(1)

Etc.

God Bless,

Mark A. Sam



Hi all,

In a database of mine I have a table containing persons' name, address
and
so on. In the corresponding form I have of course all the fields where
the
users put in the data. In this form I want to have a list showing all
the
persons in the table as well, so that the users can click the right
person
in
the list and have his or her data filled into the fields. I have tried
to
make a table form from the same table and include it as a subform.
This,
however, was not successful because the subform only showed the person
in
focus in the form, not all the persons in the table. Also, I do not
think
it
would be possible to click a person in the subform and get the data
filled
into the fields, even if I a got all the persons in the table.

If you have a good idea how to make this, please let me know.

Thank you very much in advance.

Jo
 
Top