By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,224 Members | 1,609 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,224 IT Pros & Developers. It's quick & easy.

AfterUpdate Event for auto fill

100+
P: 418
I have a table called tblFunds with these fields: FundID (PK / Auto), FundNo (Text), FundDescr(Text), GrantNo (Text).

In a form I have several fields that came from different tables. Two of the fields came from the tblFunds: FundID (Name: cboFund) and GrantNo (txtGrant). I have this After Update Event for FundID:
Private Sub cboFund_AfterUpdate()
Me.txtGrant = Me.cboFund.Column(3)
End Sub
But itís not populating the Grant Number upon entering the fund number and leaving it blank. What am I doing wrong?

Thanks.
Apr 28 '09 #1
Share this Question
Share on Google+
18 Replies


Expert 100+
P: 1,287
I would guess that it is because the combo box columns are zero indexed. Should it be .Column(2)?
Apr 28 '09 #2

100+
P: 418
I have:
Bound Column: 1
Column Counts: 3
Column Heads: No
Column Width: 0”;1”;1”;
Apr 28 '09 #3

Expert 100+
P: 1,287
So you have .Column(0), .Column(1), and .Column(2)
Apr 28 '09 #4

100+
P: 418
Are you suggesting I have wrong column widths? Since the table has four columns and I want the 4th column to pull the data from (which the GrantNo) the column widths should be 0";1";1";1";

I don't think I am understanding. Forgive me but I am new at this things.

Thanks.
Apr 28 '09 #5

Expert 100+
P: 1,287
The table may have four columns, but the combo box does not. You may need to change or redo the combo box.
Apr 28 '09 #6

100+
P: 418
My combo box on the form is called: cboFund. Post #3 refers to what is shown on Format Tab of cboFund.

Do I read you correct? Thanks.
Apr 28 '09 #7

Expert 100+
P: 1,287
Right, your combo box has 3 columns. If you want to get the number in the third comlumn, you want cboFund.Column(2).
Apr 28 '09 #8

100+
P: 418
I changed it to read:
Expand|Select|Wrap|Line Numbers
  1. Private Sub cboFund_AfterUpdate()
  2. Me.txtGrant = Me.cboFund.Column(2)
  3. End Sub
End result was the same. No data in txtGrant
Apr 28 '09 #9

Expert 100+
P: 1,287
What's the data source for cboFund?
Apr 28 '09 #10

100+
P: 418
I have a table called tblFunds with these fields: FundID (PK / Auto), FundNo (Text), FundDescr(Text), GrantNo (Text).

cboFund is pulling data from FundID
Apr 28 '09 #11

Expert 100+
P: 1,287
What's in the other columns then?
Apr 28 '09 #12

100+
P: 418
Are you asking the data in tblFunds?

FundID: PK (Auto)
FundNo: Text (Let's say Fund number is 872)
FundDescr: Text (in this example: 872 is UPA)
GrantNo: Text (in this example: MN040012)
Apr 28 '09 #13

NeoPa
Expert Mod 15k+
P: 31,707
M,

Your GrantNo field is not included in your ComboBox control, so it is in none of the columns.
Apr 28 '09 #14

100+
P: 418
NeoPa:

I thought that's what I did. Please see post #5. And thanks for keeping an eye for this novice.
Apr 28 '09 #15

NeoPa
Expert Mod 15k+
P: 31,707
@ChipR
If you answer this question (the property we're looking for is Row Source), then we can illustrate why it's failing, and what to do to fix it.
Apr 28 '09 #16

NeoPa
Expert Mod 15k+
P: 31,707
@MNNovice
This (Column widths) won't effect what data is returned. Merely what is shown on screen when the control is dropped down.

Please see earlier post for how to make progress.
@MNNovice
Always a pleasure.
Apr 28 '09 #17

100+
P: 418
NeoPa;

I knew I was doing something really "goofeey". Thank you. It's working now. But tell me how did you figure that this was the problem? Man!! you're too good. No wonder you're the ADMINISTRATOR...LOL

Thanks.

M
Apr 28 '09 #18

NeoPa
Expert Mod 15k+
P: 31,707
Always happy to help M, but to be fair, I suspect Chip was trying to lead you in the same direction too.

Glad you got it resolved anyway :)
Apr 28 '09 #19

Post your reply

Sign in to post your reply or Sign up for a free account.