F
FA
I have a problem that my code is not working i dont know what i am
doing wrong? can someone help me out please;
I have a form called frmSystem---- Control source = dbo_SYS_INO
On that form i have four controls
textbox -- SYS_NME--- Bound to Field SYS_NME in dbo_SYS_INFO
textbox-- SYS_CODE-- Bound to field SYS_CODE in dbo_SYS_INFO
textbox-- CODE-- Unbound -- Control Source = GetAbbrevs(Me.SYS_NME) &
"V"
Where the GetAbbrevs is a Function
Public Function GetAbbrevs(sText As String) As String
Dim sTmp As String
sText = Trim(sText)
Do While InStr(1, sText, " ") > 0
sTmp = sTmp & Left(sText, 1)
sText = Mid(sText, InStr(1, sText, " ") + 1)
Loop
GetAbbrevs = sTmp & Left(sText, 1)
End Function
Also i have a command button --- Command566
In the OnClick event of the command button
i have something like this
Private Sub Command566_Click()
If Me.NewRecord Then
Dim strSysNumber
Dim varResult As Variant
strSysNumber = "SYS_CODE Like """ & Me.CODE & "*"""
varResult = DMax("SYS_CODE", "dbo_SYS_INFO",
strSysNumber)
If IsNull(varResult) Then
Me.SYS_CODE = Me.CODE & "01"
Else
Me.SYS_CODE = Me.CODE &
Format(Val(Right(varResult, 2)) + 1, "00")
End If
End If
When i click the command button nothing happens. textbox CODE is
showing me the abbreviated SYS_NME so my command button codes should
read the data in textbox CODE and compare it with SYS_CODE in the table
and if exist add 1 to it.
No compile error, it just nothing happen when i click the command
button.
Please help!!!
Moe
doing wrong? can someone help me out please;
I have a form called frmSystem---- Control source = dbo_SYS_INO
On that form i have four controls
textbox -- SYS_NME--- Bound to Field SYS_NME in dbo_SYS_INFO
textbox-- SYS_CODE-- Bound to field SYS_CODE in dbo_SYS_INFO
textbox-- CODE-- Unbound -- Control Source = GetAbbrevs(Me.SYS_NME) &
"V"
Where the GetAbbrevs is a Function
Public Function GetAbbrevs(sText As String) As String
Dim sTmp As String
sText = Trim(sText)
Do While InStr(1, sText, " ") > 0
sTmp = sTmp & Left(sText, 1)
sText = Mid(sText, InStr(1, sText, " ") + 1)
Loop
GetAbbrevs = sTmp & Left(sText, 1)
End Function
Also i have a command button --- Command566
In the OnClick event of the command button
i have something like this
Private Sub Command566_Click()
If Me.NewRecord Then
Dim strSysNumber
Dim varResult As Variant
strSysNumber = "SYS_CODE Like """ & Me.CODE & "*"""
varResult = DMax("SYS_CODE", "dbo_SYS_INFO",
strSysNumber)
If IsNull(varResult) Then
Me.SYS_CODE = Me.CODE & "01"
Else
Me.SYS_CODE = Me.CODE &
Format(Val(Right(varResult, 2)) + 1, "00")
End If
End If
When i click the command button nothing happens. textbox CODE is
showing me the abbreviated SYS_NME so my command button codes should
read the data in textbox CODE and compare it with SYS_CODE in the table
and if exist add 1 to it.
No compile error, it just nothing happen when i click the command
button.
Please help!!!
Moe