Textbox not getting value

M

Mark A. Sam

Hello,

In the code snippit belows, textboxes are being filled in on a subform. In
one scenario for the line numbered 1 a particular textbox will be filled
with dashes (---) then the line numbered 2 will fill an adjacent textbox
with the string, "-Buf NY". Whenever line 1 is run, then the second textbox
doesn't receive the text, "-Buf NY". If I rem out line 1 then -Buf NY gets
accepted. After I run the procedure, I am able to manually type in "-Buf NY"
into the textbox.

If I step through the code and line 2 gets run and test the field value in
the immediate window before the .Update method, it displays the correct
value, but never gets entered into the textbox.

I am developing this with Access 2007. I don't know if I have given enough
information, but I am trying to keep the explanation simple.


'Load Middle day - fill in (-------) for full days between drops
Dim iDays As Integer
iDays = DateDiff("d", !TripStartDate, !TripEndDate)
Dim i As Integer
Dim iWidth As Integer 'Width of the column to caluculate how many dashes (-)
will fill it (Width/80)
If iDays > 1 Then
If Not IsNull(![TripEndDate]) Then
For i = 1 To iDays - 1
rst.Edit
iWidth =
TripRptDiagram.Form.Controls(rst.Fields(Format(![TripStartDate] + 1,
"dddd")).Name).ColumnWidth
1 TripRptDiagram.Form.Controls(rst.Fields(Format(![TripStartDate] + 1,
"dddd")).Name) = String(Int(iWidth / 80), "-")
rst.Update
Next i
End If
End If

'Load End Day
strLoc = Left(Parse(![TripEndLoc], 1, ","), 3) & " " &
Parse(![TripEndLoc], 2, ",")
rst.Edit
If ![TripEndDate] = ![TripStartDate] Then
'Strip out extra dashes (-) and format for same day load and unload
rst.Fields(![TripEndDay]) = Parse(rst.Fields(![TripEndDay]), 1, "-") &
"---" & strLoc
TripRptDiagram.Form.Controls(rst.Fields(Format(![TripStartDate],
"dddd")).Name).ColumnWidth = 2100
ElseIf IsNull(rst.Fields(![TripEndDay])) Then
2 rst.Fields(![TripEndDay]) = "-" & strLoc
Else
rst.Fields(![TripEndDay]) = rst.Fields(![TripEndDay]) & vbCrLf & "-" &
strLoc
End If
rst.Update
.MoveNext
Loop


Thank you for any help and God Bless,

Mark A. Sam
 

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

Top