Selection in Combo box auto fills two other fields that can be cha

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

Guest

I have two tables, Employees and PTypes. PTypes has three columns/fields.

I'm creating a form for data entry. I created a combo box based off the
PTypes table. I'd like to make it so that when the user selects from the
PTypes combo box, two other fields are auto filled with data from the same
table, but are able to change the entry if ever needed. The importance of
the latter is secondary.

I saw a similar question in the discussion group, but I'm not familiar with
coding and such. If you have an answer, please make it understandable to
someone who needs an "Access for Dummies" book. Thanks. =)
 
Follow this steps
1. Open the form in design view
2. In the Row Source property of the PTypes Combo, specify all three fields
from the PTypes table
Select Field1,Field2,Field3 from PTypes

3. On the after update event of the PTypes combo write the code (When you
are in the after update event property youll see a button with three dots on
the right, click on it and select code)

Me.Field2NameInTheForm = Me.PTypesComboName.Column(1)
Me.Field3NameInTheForm = Me.PTypesComboName.Column(2)

The column number apply to the location of the fields in the row source of
the combo, start with 0
So Field2 in the select statement above will be column(1)
 
Thanks, Ofer. I'm still having problems with it. Here's what I did... I
specified all three fields from the PTypes table. On the after update event
of the PTypes combo I wrote the code:

Private Sub cboPassType_AfterUpdate()
Me.AmountNameInTheForm = Me.cboPassType.Column(1)
Me.Code#NameInTheForm = Me.cboPassType.Column(2)
End Sub

I keep getting a lot of errors and I can't debug. The names of the fields
in the table are PTypes, Amount and Code #. The labels for them in the form
is Amount and Code #. So, what should the code look like?

Thanks in advance.
 
Try this

Private Sub cboPassType_AfterUpdate()
Me.[Amount] = Me.cboPassType.Column(1)
Me.[Code #] = Me.cboPassType.Column(2)
End Sub
 
lol...the Amount field worked, but the Code # one didn't. So, I tried
changing the name of this field to just Code (without the #) in all locations
including the field name/column heading in the table, which automatically
changed it in the RecordSource for cboPassTypes. I also changed any
reference to a "#" in all tabs of the properties of the Code label and text
box. Any ideas?

(wow...I feel so close yet so far...just one more text box to prefill!!)

Ofer said:
Try this

Private Sub cboPassType_AfterUpdate()
Me.[Amount] = Me.cboPassType.Column(1)
Me.[Code #] = Me.cboPassType.Column(2)
End Sub
--
I hope that helped
Good luck


ETC said:
Thanks, Ofer. I'm still having problems with it. Here's what I did... I
specified all three fields from the PTypes table. On the after update event
of the PTypes combo I wrote the code:

Private Sub cboPassType_AfterUpdate()
Me.AmountNameInTheForm = Me.cboPassType.Column(1)
Me.Code#NameInTheForm = Me.cboPassType.Column(2)
End Sub

I keep getting a lot of errors and I can't debug. The names of the fields
in the table are PTypes, Amount and Code #. The labels for them in the form
is Amount and Code #. So, what should the code look like?

Thanks in advance.
 
Check two things

1. That the name of the field in form is correct, the easiest way will be,
to type "Me" and then the dot
Me.
Access will list the fields form you, choose the right field name, if the
name is split into two words like "number #" then put it in square brackets
[number #]

2. The ColumnCount Property of the combo, says 3 as the number of your column

--
I hope that helped
Good luck


ETC said:
lol...the Amount field worked, but the Code # one didn't. So, I tried
changing the name of this field to just Code (without the #) in all locations
including the field name/column heading in the table, which automatically
changed it in the RecordSource for cboPassTypes. I also changed any
reference to a "#" in all tabs of the properties of the Code label and text
box. Any ideas?

(wow...I feel so close yet so far...just one more text box to prefill!!)

Ofer said:
Try this

Private Sub cboPassType_AfterUpdate()
Me.[Amount] = Me.cboPassType.Column(1)
Me.[Code #] = Me.cboPassType.Column(2)
End Sub
--
I hope that helped
Good luck


ETC said:
Thanks, Ofer. I'm still having problems with it. Here's what I did... I
specified all three fields from the PTypes table. On the after update event
of the PTypes combo I wrote the code:

Private Sub cboPassType_AfterUpdate()
Me.AmountNameInTheForm = Me.cboPassType.Column(1)
Me.Code#NameInTheForm = Me.cboPassType.Column(2)
End Sub

I keep getting a lot of errors and I can't debug. The names of the fields
in the table are PTypes, Amount and Code #. The labels for them in the form
is Amount and Code #. So, what should the code look like?

Thanks in advance.

:

Follow this steps
1. Open the form in design view
2. In the Row Source property of the PTypes Combo, specify all three fields
from the PTypes table
Select Field1,Field2,Field3 from PTypes

3. On the after update event of the PTypes combo write the code (When you
are in the after update event property youll see a button with three dots on
the right, click on it and select code)

Me.Field2NameInTheForm = Me.PTypesComboName.Column(1)
Me.Field3NameInTheForm = Me.PTypesComboName.Column(2)

The column number apply to the location of the fields in the row source of
the combo, start with 0
So Field2 in the select statement above will be column(1)

--
I hope that helped
Good luck


:

I have two tables, Employees and PTypes. PTypes has three columns/fields.

I'm creating a form for data entry. I created a combo box based off the
PTypes table. I'd like to make it so that when the user selects from the
PTypes combo box, two other fields are auto filled with data from the same
table, but are able to change the entry if ever needed. The importance of
the latter is secondary.

I saw a similar question in the discussion group, but I'm not familiar with
coding and such. If you have an answer, please make it understandable to
someone who needs an "Access for Dummies" book. Thanks. =)
 
Omigosh!!! It worked!! It was the Column count. Thanks SOOO much for ALL
of your time! I really really do appreciate it. If there's ever anything I
can do for you, just let me know!

Ofer said:
Check two things

1. That the name of the field in form is correct, the easiest way will be,
to type "Me" and then the dot
Me.
Access will list the fields form you, choose the right field name, if the
name is split into two words like "number #" then put it in square brackets
[number #]

2. The ColumnCount Property of the combo, says 3 as the number of your column

--
I hope that helped
Good luck


ETC said:
lol...the Amount field worked, but the Code # one didn't. So, I tried
changing the name of this field to just Code (without the #) in all locations
including the field name/column heading in the table, which automatically
changed it in the RecordSource for cboPassTypes. I also changed any
reference to a "#" in all tabs of the properties of the Code label and text
box. Any ideas?

(wow...I feel so close yet so far...just one more text box to prefill!!)

Ofer said:
Try this

Private Sub cboPassType_AfterUpdate()
Me.[Amount] = Me.cboPassType.Column(1)
Me.[Code #] = Me.cboPassType.Column(2)
End Sub
--
I hope that helped
Good luck


:

Thanks, Ofer. I'm still having problems with it. Here's what I did... I
specified all three fields from the PTypes table. On the after update event
of the PTypes combo I wrote the code:

Private Sub cboPassType_AfterUpdate()
Me.AmountNameInTheForm = Me.cboPassType.Column(1)
Me.Code#NameInTheForm = Me.cboPassType.Column(2)
End Sub

I keep getting a lot of errors and I can't debug. The names of the fields
in the table are PTypes, Amount and Code #. The labels for them in the form
is Amount and Code #. So, what should the code look like?

Thanks in advance.

:

Follow this steps
1. Open the form in design view
2. In the Row Source property of the PTypes Combo, specify all three fields
from the PTypes table
Select Field1,Field2,Field3 from PTypes

3. On the after update event of the PTypes combo write the code (When you
are in the after update event property youll see a button with three dots on
the right, click on it and select code)

Me.Field2NameInTheForm = Me.PTypesComboName.Column(1)
Me.Field3NameInTheForm = Me.PTypesComboName.Column(2)

The column number apply to the location of the fields in the row source of
the combo, start with 0
So Field2 in the select statement above will be column(1)

--
I hope that helped
Good luck


:

I have two tables, Employees and PTypes. PTypes has three columns/fields.

I'm creating a form for data entry. I created a combo box based off the
PTypes table. I'd like to make it so that when the user selects from the
PTypes combo box, two other fields are auto filled with data from the same
table, but are able to change the entry if ever needed. The importance of
the latter is secondary.

I saw a similar question in the discussion group, but I'm not familiar with
coding and such. If you have an answer, please make it understandable to
someone who needs an "Access for Dummies" book. Thanks. =)
 
I'll keep it in mind, thank you.
Happy I could help

--
I hope that helped
Good luck


ETC said:
Omigosh!!! It worked!! It was the Column count. Thanks SOOO much for ALL
of your time! I really really do appreciate it. If there's ever anything I
can do for you, just let me know!

Ofer said:
Check two things

1. That the name of the field in form is correct, the easiest way will be,
to type "Me" and then the dot
Me.
Access will list the fields form you, choose the right field name, if the
name is split into two words like "number #" then put it in square brackets
[number #]

2. The ColumnCount Property of the combo, says 3 as the number of your column

--
I hope that helped
Good luck


ETC said:
lol...the Amount field worked, but the Code # one didn't. So, I tried
changing the name of this field to just Code (without the #) in all locations
including the field name/column heading in the table, which automatically
changed it in the RecordSource for cboPassTypes. I also changed any
reference to a "#" in all tabs of the properties of the Code label and text
box. Any ideas?

(wow...I feel so close yet so far...just one more text box to prefill!!)

:

Try this

Private Sub cboPassType_AfterUpdate()
Me.[Amount] = Me.cboPassType.Column(1)
Me.[Code #] = Me.cboPassType.Column(2)
End Sub
--
I hope that helped
Good luck


:

Thanks, Ofer. I'm still having problems with it. Here's what I did... I
specified all three fields from the PTypes table. On the after update event
of the PTypes combo I wrote the code:

Private Sub cboPassType_AfterUpdate()
Me.AmountNameInTheForm = Me.cboPassType.Column(1)
Me.Code#NameInTheForm = Me.cboPassType.Column(2)
End Sub

I keep getting a lot of errors and I can't debug. The names of the fields
in the table are PTypes, Amount and Code #. The labels for them in the form
is Amount and Code #. So, what should the code look like?

Thanks in advance.

:

Follow this steps
1. Open the form in design view
2. In the Row Source property of the PTypes Combo, specify all three fields
from the PTypes table
Select Field1,Field2,Field3 from PTypes

3. On the after update event of the PTypes combo write the code (When you
are in the after update event property youll see a button with three dots on
the right, click on it and select code)

Me.Field2NameInTheForm = Me.PTypesComboName.Column(1)
Me.Field3NameInTheForm = Me.PTypesComboName.Column(2)

The column number apply to the location of the fields in the row source of
the combo, start with 0
So Field2 in the select statement above will be column(1)

--
I hope that helped
Good luck


:

I have two tables, Employees and PTypes. PTypes has three columns/fields.

I'm creating a form for data entry. I created a combo box based off the
PTypes table. I'd like to make it so that when the user selects from the
PTypes combo box, two other fields are auto filled with data from the same
table, but are able to change the entry if ever needed. The importance of
the latter is secondary.

I saw a similar question in the discussion group, but I'm not familiar with
coding and such. If you have an answer, please make it understandable to
someone who needs an "Access for Dummies" book. Thanks. =)
 
Back
Top