Can't figure out what is wrong with mycode. I have table "tbl_Tracking" with filed "EHT_Stage" and a form"frmTrackingProgress" with field name"txtEHTStage" (controlsource "EHT_Stage") and unbound column named "txtDescr"
What I am trying to accomplish is based on value in "txtEHTStage"populate column "txtDescr"
What my code does however, is that itevaluates only first record in txtEHTStage and fill out the column"txtDescr" with the same values ignoring the rest.
For example
txtEHTStage, txtDescr
1 Designed
0 Designed
2 Designed
What I am expecting to see is
txtEHTStage txtDescr
1 Designed
0 Designnot Started
2 Checked
Thanks for your help.
[CODE]
Option Compare Database
Option Explicit
Dim db As DAO.Database
Dim rs As DAO.Recordset
Private Sub Form_Load()
Dim txtDescr As String
Set db = CurrentDb
Set rs =db.OpenRecordSet("tbl_Tracking", dbOpenDynaset, dbSeeChanges)
Do While Not rs.EOF
If Nz(IsNull(Me.txtEhtStage)) Then
Me.txtDescr = "N/A"
ElseIf Me.txtEhtStage = "" Then
Me.txtDescr = "Not Required"
ElseIf Me.txtEhtStage = "0" Then
Me.txtDescr = "Design not Started"
ElseIf Me.txtEhtStage = "1" Then
Me.txtDescr = "Designed"
ElseIf Me.txtEhtStage = "2" Then
Me.txtDescr = "Checked"
Else
Me.txtDescr = "Hold"
End If
rs.MoveNext
Loop
End Sub
[/CODE]