Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 If me. txt not working ???

Author  Topic 

caljohn527
Starting Member

4 Posts

Posted - 2009-02-04 : 21:03:55
Hello to you all.

This is what I try to do and is not working ???
MS SQL Server 2003 and Access 2002

Private Sub emppoint1_BeforeUpdate(Cancel As Integer)
If me.txt_empappearance = poor Then me.txt_emppoint1 = 5
If me.txt_empappearance = Good Then me.txt_emppoint1 = 10
If me.txt_empappearance = Fair Then me.txt_emppoint1 = 15
If me.txt_empappearance = Excellent Then me.txt_emppoint1 = 20 not working ??? ( The return is #Nmae? )

End Sub

Private Sub emppoint1_BeforeUpdate(Cancel As Integer)
If txt_empappearance = poor Then txt_emppoint1 = 5
If txt_empappearance = Good Then txt_emppoint1 = 10
If txt_empappearance = Fair Then txt_emppoint1 = 15
If txt_empappearance = Excellent Then txt_emppoint1 = 20 not working ??? ( The return is #Nmae? )

End Sub

empappearance is a combo box = ( Poor – Fair – Good – Excellent )
emppoint1 is the receiving end ( 5 – 10 – 15 – 20 )
emppoint1 / right click / go to properties /
name = emppoint1 / Control Source = emppoint1 / Format = blank / Decimal places = auto /
Input Mask = blank / Default Value = blank .

In The Tables we have empappearance / nvarchar / 10
In The Tables we have emppoint1 / smallint / 2

What am I doing so wrong ?????


Johnny C And Thank you all for your help…

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2009-02-04 : 22:28:18
This is forum for SQL Server.
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-02-05 : 05:04:14
I think you should enclose your combobox checks with double quote character, unless values are enumerations.

If txt_empappearance = "poor" Then txt_emppoint1 = 5


E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

caljohn527
Starting Member

4 Posts

Posted - 2009-02-05 : 06:11:15
Hi PESO and thank you for the information.
But it is not working.

SQL Server 2003 and Access 2002

Private Sub emppoint1_BeforeUpdate(Cancel As Integer)
If txt_empappearance = "poor" Then txt_emppoint1 = 5
If txt_empappearance = "Good" Then txt_emppoint1 = 10
If txt_empappearance = "Fair" Then txt_emppoint1 = 15
If txt_empappearance = "Excellent" Then txt_emppoint1 = 20 not working ??? ( The return is #Nmae? ) Same result


Johnn C
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-02-05 : 06:15:17
You have also named a combobox with txt?

Try

If txt_empappearance.Value = "poor" Then txt_emppoint1.Text = 5
etc etc



E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

caljohn527
Starting Member

4 Posts

Posted - 2009-02-05 : 06:40:44
Hi Peso and thank you for your time and effort.

I tried this But not work .

Private Sub emppoint1_BeforeUpdate(Cancel As Integer)
If txt_empappearance.Value = "poor" Then txt_emppoint1.Text = 5
If txt_empappearance.Value = "Good" Then txt_emppoint1.Text = 10
If txt_empappearance.Value = "Fair" Then txt_emppoint1.Text = 15
If txt_empappearance.Value = "Excellent" Then txt_emppoint1.Text = 20
End Sub
not working ??? ( The return is #Nmae? ) Same result


Johnn C
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-02-05 : 07:36:22
What line is producing the error?



E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

caljohn527
Starting Member

4 Posts

Posted - 2009-02-05 : 19:42:25

Hi Peso Read This If You have The Time .

Dim text As String
If IsNull(Me.empappearance.Value) = False Then
text = Me.empappearance.Value
Select Case text
Case "Good"
Me.emppoint.Value = 1
Case "Poor"
Me.emppoint.Value = 2
Case "Excellent"
Me.emppoint.Value = 3
Case "Fair"
Me.emppoint.Value = 4
Case Else
Me.emppoint.Value = "Nothing"
End Select
End If
End Sub

When I try to compile this I get an error,
and it said Microsoft Visual Basic
Compile error
Invalid Outside Procedure

On the first line at the Me. it stops Compile.If IsNull(Me.???


Johnny C
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-02-06 : 00:21:51
Is ISNULL a VB function?

If Me.empappearance.Value) > "" Then
text = Me.empappearance.Value


E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page
   

- Advertisement -