Ok, since my day is almost over anyways, and to help out sooner rather than later, I am going to post the code stuffs anyways. My disclaimer is that this is not my code really. I replaced the guy who was here before me since he moved on. He made most of this MS Access DB program. I have not coded at all in VB until 2 months ago when I got this job, and that first month was spent learning about VB. I have coded in other languages for 5 years though so I can look at VB and understand most of it.
Here is the code in its pieces:
Public Property Get strtxtref() As String
strtxtref = "cmbpgmref, cmbfinref, cmbaccref, cmbdesref, cmbclrref, cmbeworef, cmbprcref, cmbamtref"
End Property
Those cmbpgmref and others are the combo boxes' names that are going to be reset.
Private Function setdefault(str As String)
Do While Len(str) > 0
Form_FormNameHere(clsaction.firstcon(str)).Value = _
clsaction.formatstring(Form_FormNameHere(clsaction.firstcon(str)).DefaultValue())
str = clsaction.concat(str)
If Mid(str, 1, 3) = "cal" Then
str = clsaction.concat(str)
End If
Loop
End Function
This is called with the line "setdefault strtxtref" to pass it the names of the fields to be reset.
The other subfunctions called from a module:
Public Function firstcon(str As String) As String
Dim spot As Integer
spot = InStr(str, ",")
If spot = 0 Then
firstcon = str
Exit Function
End If
firstcon = Mid(str, 1, spot - 1)
End Function
AND
Public Function concat(str As String) As String
Dim spot As Integer
spot = InStr(str, ",")
If spot = 0 Then
concat = ""
Exit Function
End If
concat = Mid(str, spot + 2, Len(str) - 1)
End Function
Those from my understanding cycle through the combo boxes names to fix them one by one.
**It could just be that if that was your exact line of code, adding the () to the end of DefaultValue would work?
Sorry for the long post but I hope one of these ideas helps.
I would feel helpful back to the Tek-Tips community for a change with as much as I have learned from all of you over the past 2 months.
~
Give a some fire, he will be warm for a day, Set a man on fire, he will be warm for the rest of his life.