Renewed concatenation issue

SteveL

Registered User.
Local time
Today, 10:58
Joined
Dec 3, 2004
Messages
60
For whatever reason I cannot get debugging to work. But let me say this... if I put the following code in an onclick event of the field, "txtCombinedCbxRecordInfo", which is the field I am trying to populate with the oncurrent event of the form, IT WORKS!!! Here is the code that is workig on the onclick event... (Please read below this copy/pasted code)

-=-=-=-=-=-=-=-
' Code to fill combine field with concatenated text
Dim rst As dao.Recordset
Dim txt As String

If Not Me.NewRecord Then
'open a recordset on the child records of the current record in Me
Set rst = CurrentDb.OpenRecordset( _
"SELECT [Core Sand Type] " & _
"FROM tblCbxNumberData " & _
"WHERE PartN = '" & Me.cboPartN & "'")

With rst
Do While Not .EOF
'if the field is non-null, concatenate
If Not IsNull(.Fields(0)) Then txt = txt & .Fields(0) & "/"
.MoveNext
Loop
.Close
End With
'drop the trailing "/"
If txt <> "" Then txt = Left(txt, Len(txt) - 1)
End If

Me.txtCombinedCbxRecordInfo = txt
' End of code to fill combine field with concatenated text
-=-=-=-=-=-=-
But when I put this same code in the on current event of the form along with other code I have had in there for some time, it does not work. Here is the complete on current event code...
-=-=-=-=-
'for developmental purposes
'If Len(Dir("C:\Company\General Shared Files\PRINTS\" & Me.txtPartN & "\*.*")) = 0 Then
' Me.chkprints = False
'Else
' Me.chkprints = True
'End If
'end of for developmental purposes

'for State Line purposes
If Len(Dir("\\Sbs1\Company\General Shared Files\PRINTS\" & Me.txtPartN & "\*.*")) = 0 Then
Me!chkprints = False
Else
Me!chkprints = True
End If
'end of for stateline purposes

Me.List1.Requery
Me.txtCPC = DSum("CPC", "tblCbxNumberData", "(PartN = '" & Me.txtPartN & "')")
Me.txtCBs = DCount("CPC", "tblCbxNumberData", "(PartN = '" & Me.txtPartN & "')")

' Code to fill combine field with concatenated text
Dim rst As dao.Recordset
Dim txt As String

If Not Me.NewRecord Then
'open a recordset on the child records of the current record in Me
Set rst = CurrentDb.OpenRecordset( _
"SELECT [Core Sand Type] " & _
"FROM tblCbxNumberData " & _
"WHERE PartN = '" & Me.cboPartN & "'")

With rst
Do While Not .EOF
'if the field is non-null, concatenate
If Not IsNull(.Fields(0)) Then txt = txt & .Fields(0) & "/"
.MoveNext
Loop
.Close
End With
'drop the trailing "/"
If txt <> "" Then txt = Left(txt, Len(txt) - 1)
End If

Me.txtCombinedCbxRecordInfo = txt
' End of code to fill combine field with concatenated text
-=-=-=-=-

Any thoughts?
 
Put a breakpoint in the OnCurrent code so you can single step the code and see what is going on.
 
Why start another thread on an existing topic?
 
Rich,

I only did it because I thought the original topic was getting confusing. I am able to get this concatenation to work as I stated above with an onclick event of the field. But oncurrent of the form still does not work.
 
Do like RuralGuy suggests and put a breakpoint in the On Current code and follow it through to see what is happening (or not happening).
 
But I'm sorry... I do not know how to do this.
 
I can zip it (FE and BE) and post. But I'll have to also write a long explanation of what I am trying to do. Is that ok?
 
I can zip it (FE and BE) and post. But I'll have to also write a long explanation of what I am trying to do. Is that ok?

I think it might be faster to do it that way, at this point.
 
Oh, and did you remember to use COMPACT and REPAIR on both FE and BE before zipping?
 

Users who are viewing this thread

Back
Top Bottom