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 John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Writing to Table Problems

Status
Not open for further replies.

Jengo

Programmer
Apr 17, 2000
100
US
Can someone please tell me why this code is not writing back to the table?&nbsp;&nbsp;I took the error handling out to see where the problem is and there it goes through and finds the change and supposably writes to the table but when I check the table nothing has changed.&nbsp;&nbsp;Below, what I have are 2 combo boxes called Combo12 and Combo14. Combo12 has values like &quot;Network&quot; and &quot;Desktop&quot;, and Combo14 has the values of &quot;Yes&quot; or &quot;No&quot;.&nbsp;&nbsp;If you need more explaination just ask.&nbsp;&nbsp;But I am stumped.<br><br>---------------------------------------------------------<br><br>Private Sub Combo14_Click()<br><br>Dim tmp As String<br>Dim x, y, z, a As Integer<br>Dim dbs As Database<br>Dim tdf As Recordset<br><br>If IsNull(Assigned_To.Value) Then<br>&nbsp;&nbsp;&nbsp;&nbsp;If IsNull(Username.Value) Then<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Combo14.Value = &quot;&quot;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Exit Sub<br>&nbsp;&nbsp;&nbsp;&nbsp;End If<br>End If<br><br>DoEvents<br>Set dbs = CurrentDb()<br>Set tdf = dbs.OpenRecordset(&quot;Employee Table&quot;)<br><br>For y = 1 To List2.ListCount - 1<br>&nbsp;&nbsp;&nbsp;&nbsp;If Combo12.Value = List2.ItemData(y) Then<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tmp = &quot;&quot;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tdf.MoveFirst<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;For x = 0 To a<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tdf.MoveNext<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Next x<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tdf.Edit<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tmp = Combo14.Value<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tdf.Fields(y + 1).Value = tmp<br>&nbsp;&nbsp;&nbsp;&nbsp;End If<br>Next y<br><br>Set tdf = Nothing<br><br>End Sub<br>
 
just a quick glance but <br><br>tdf.update needs to be placed just before your last end if<br>&nbsp;&nbsp;&nbsp;&nbsp;<br>
 
Two questions:<br><br>What is List2? and how is it being used?<br><br>If you could explain exactly what the user is supposed to be doing, we can give you the answer. I already think I know, but I would like a little more clarification.<br><br>Thanks <p>Jim Lunde<br><a href=mailto:compugeeks@hotmail.com>compugeeks@hotmail.com</a><br><a href= Application Development
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top