Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

update field based on column in combo box fails

Status
Not open for further replies.

cdck

Programmer
Nov 25, 2003
281
US
I have a combo box with an After Update event that is meant to move to a new record and then set several other fields on the form to the value of secondary columns in the combo box. It moves to the new record correctly and sets the values of the first two fields, but then stops - it leaves all the other values NULL. Here is the code - can anyone tell me what is wrong?

[tt]
Private Sub cbAddJob_AfterUpdate()
On Error GoTo Err_cbAddJob_AfterUpdate

DoCmd.GoToRecord , , acNewRec

Me!fjobno.Value = Me!cbAddJob.Column(0)
Me!fcompany.Value = Me!cbAddJob.Column(1)
Me!fquantity.Value = Me!cbAddJob.Column(2)
Me!fmeasure.Value = Me!cbAddJob.Column(3)
Me!fpartno.Value = Me!cbAddJob.Column(4)
Me!fcudrev.Value = Me!cbAddJob.Column(5)
Me!fdescript.Value = Me!cbAddJob.Column(6)

Exit_cbAddJob_AfterUpdate:
Exit Sub

Err_cbAddJob_AfterUpdate:
MsgBox Err.Description
Resume Exit_cbAddJob_AfterUpdate
End Sub
[/tt]



Cheryl dc Kern
 
Just fooling around, I tried copying the ".Value = Me!cbAddJob.Column(" from the first line and pasting it over that section on all following lines. Now the code works correctly. Yet when I copy both sets of code into word documents and compare them, word finds no differences - not even a space.

I have another section of code that is a loop which fails to lop even though the logic is sound. This makes me think there is something in the typing that makes it fail. Can anyone offer advice as to the types of things to look for?

Cheryl dc Kern
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top