Code to update poplate textbox on form

  • Thread starter Thread starter red6000
  • Start date Start date
R

red6000

Hi I have a table called CSRNames with 2 Columns, 1 called CSRNames and 1
called TM.

I then have a form which has 2 comboboxes, 1 for CSRNames column and 1 for
the TM column.

What I would like to do is for the TM combox box to auto populate based on
the name chosen in the CSRName combox. I've tried the following, but it
isn't working:

Private Sub CSRName_Change()
Dim varX As Variant
varX = DLookup("[TM]", "CSRNames", "[CSRNames] = Me!CSRName.Value")
Me!Team_Manager.Value = varX
End Sub

Any help appreciated.

Thanks.
 
Okay I've got it to work with the code below. However if I change the
original name chosen, the Team_Manager field is not updating on screen
although it does appear to be updating in background. Any ideas?

Dim varX As Variant
varX = DLookup("[TM]", "CSRNames", "[CSRNames] = '" & Me!CSRName & "'")
Me!Team_Manager.Value = varX
 
See whether http://office.microsoft.com/en-ca/assistance/HA011730581033.aspx
helps.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


red6000 said:
Okay I've got it to work with the code below. However if I change the
original name chosen, the Team_Manager field is not updating on screen
although it does appear to be updating in background. Any ideas?

Dim varX As Variant
varX = DLookup("[TM]", "CSRNames", "[CSRNames] = '" & Me!CSRName & "'")
Me!Team_Manager.Value = varX



red6000 said:
Hi I have a table called CSRNames with 2 Columns, 1 called CSRNames and 1
called TM.

I then have a form which has 2 comboboxes, 1 for CSRNames column and 1
for the TM column.

What I would like to do is for the TM combox box to auto populate based
on the name chosen in the CSRName combox. I've tried the following, but
it isn't working:

Private Sub CSRName_Change()
Dim varX As Variant
varX = DLookup("[TM]", "CSRNames", "[CSRNames] = Me!CSRName.Value")
Me!Team_Manager.Value = varX
End Sub

Any help appreciated.

Thanks.
 
Brilliant, thanks Doug.

Douglas J. Steele said:
See whether
http://office.microsoft.com/en-ca/assistance/HA011730581033.aspx helps.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


red6000 said:
Okay I've got it to work with the code below. However if I change the
original name chosen, the Team_Manager field is not updating on screen
although it does appear to be updating in background. Any ideas?

Dim varX As Variant
varX = DLookup("[TM]", "CSRNames", "[CSRNames] = '" & Me!CSRName & "'")
Me!Team_Manager.Value = varX



red6000 said:
Hi I have a table called CSRNames with 2 Columns, 1 called CSRNames and
1 called TM.

I then have a form which has 2 comboboxes, 1 for CSRNames column and 1
for the TM column.

What I would like to do is for the TM combox box to auto populate based
on the name chosen in the CSRName combox. I've tried the following, but
it isn't working:

Private Sub CSRName_Change()
Dim varX As Variant
varX = DLookup("[TM]", "CSRNames", "[CSRNames] = Me!CSRName.Value")
Me!Team_Manager.Value = varX
End Sub

Any help appreciated.

Thanks.
 

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

Back
Top