Unbound Text Box Help

  • Thread starter mattc66 via AccessMonster.com
  • Start date
M

mattc66 via AccessMonster.com

I have an unbound text box called TYPE, that I want to display the name of a
transaction type. See below code. I have added this to the BeforeUpdate and
the AfterUpdate and the TYPE remains blank.

This is DSform and the infromation is for display purposes only.

Does anyone have any suggestions on why this is not working and what I can do
to correct my ways.

Matt

Private Sub TYPE_BeforeUpdate()

If Me.TRANS_TYP = "S" Then
Me.TYPE = "SALES FORECAST"
End If

If Me.TRANS_TYP = "I" Then
Me.TYPE = "INVOICE"
End If

If Me.TRANS_TYP = "M" Then
Me.TYPE = "FIRM PLANNED MFG ORDER"
End If

If Me.TRANS_TYP = "F" Then
Me.TYPE = "WORK ORDER"
End If

If Me.TRANS_TYP = "R" Then
Me.TYPE = "FIRM PLANNED PO"
End If

If Me.TRANS_TYP = "P" Then
Me.TYPE = "PURCHASE ORDER (RELEASED)"
End If

End Sub
 
M

mattc66 via AccessMonster.com

I tried the Current Event first and this is what happens. It grabs the first
Trans_TYP and duplicates that for all records. I went ahead and changed the
name of TYPE to nTYPE.

TRANS_TYP nTYPE ITEM DATE_DUE1
P PURCHASE ORDER - RELEASED 1201-205 01/24/2008
P PURCHASE ORDER - RELEASED 2100-533 02/19/2008
I PURCHASE ORDER - RELEASED 2136-104 01/09/2008
I PURCHASE ORDER - RELEASED 2136-104 01/09/2008
I PURCHASE ORDER - RELEASED 2136-104 01/15/2008
I PURCHASE ORDER - RELEASED 2136-104 01/17/2008
P PURCHASE ORDER - RELEASED 2136-104 04/11/2008
Try putting your code in the Current event of the form. BTW, "TYPE" is a
reserved word.
http://www.allenbrowne.com/AppIssueBadWord.html
I have an unbound text box called TYPE, that I want to display the name of a
transaction type. See below code. I have added this to the BeforeUpdate and
[quoted text clipped - 34 lines]
 
R

ruralguy via AccessMonster.com

It sounds like you need to make your code a Public Function() in a standard
module and call it from the query for the DataSheet.
I tried the Current Event first and this is what happens. It grabs the first
Trans_TYP and duplicates that for all records. I went ahead and changed the
name of TYPE to nTYPE.

TRANS_TYP nTYPE ITEM DATE_DUE1
P PURCHASE ORDER - RELEASED 1201-205 01/24/2008
P PURCHASE ORDER - RELEASED 2100-533 02/19/2008
I PURCHASE ORDER - RELEASED 2136-104 01/09/2008
I PURCHASE ORDER - RELEASED 2136-104 01/09/2008
I PURCHASE ORDER - RELEASED 2136-104 01/15/2008
I PURCHASE ORDER - RELEASED 2136-104 01/17/2008
P PURCHASE ORDER - RELEASED 2136-104 04/11/2008
Try putting your code in the Current event of the form. BTW, "TYPE" is a
reserved word.
[quoted text clipped - 5 lines]
 
R

ruralguy via AccessMonster.com

BTW, a Select Case structure would be neater and easier to read.
I tried the Current Event first and this is what happens. It grabs the first
Trans_TYP and duplicates that for all records. I went ahead and changed the
name of TYPE to nTYPE.

TRANS_TYP nTYPE ITEM DATE_DUE1
P PURCHASE ORDER - RELEASED 1201-205 01/24/2008
P PURCHASE ORDER - RELEASED 2100-533 02/19/2008
I PURCHASE ORDER - RELEASED 2136-104 01/09/2008
I PURCHASE ORDER - RELEASED 2136-104 01/09/2008
I PURCHASE ORDER - RELEASED 2136-104 01/15/2008
I PURCHASE ORDER - RELEASED 2136-104 01/17/2008
P PURCHASE ORDER - RELEASED 2136-104 04/11/2008
Try putting your code in the Current event of the form. BTW, "TYPE" is a
reserved word.
[quoted text clipped - 5 lines]
 
M

mattc66 via AccessMonster.com

Can you give me suggestion on the Select Case structure. I am all for
cleaning it up. I thought the Select Case was limited on the number.
BTW, a Select Case structure would be neater and easier to read.
I tried the Current Event first and this is what happens. It grabs the first
Trans_TYP and duplicates that for all records. I went ahead and changed the
[quoted text clipped - 14 lines]
 
R

ruralguy via AccessMonster.com

Try this is a standard module:


Public Function ConvertType(strIn) As String
'-- Use: YourNewField: =ConvertType([nType])

Select Case strIn
Case "S"
ConvertType = "SALES FORECAST"
Case "I"
ConvertType = "INVOICE"
Case "M"
ConvertType = "FIRM PLANNED MFG ORDER"
Case "F"
ConvertType = "WORK ORDER"
Case "R"
ConvertType = "FIRM PLANNED PO"
Case "P"
ConvertType = "PURCHASE ORDER (RELEASED)"
Case Else
'-- Whatever you want
End Select

End Function

AFAIK there is no practical limit.
Can you give me suggestion on the Select Case structure. I am all for
cleaning it up. I thought the Select Case was limited on the number.
BTW, a Select Case structure would be neater and easier to read.
[quoted text clipped - 3 lines]
 
M

mattc66 via AccessMonster.com

Thank you - that worked great.
Try this is a standard module:

Public Function ConvertType(strIn) As String
'-- Use: YourNewField: =ConvertType([nType])

Select Case strIn
Case "S"
ConvertType = "SALES FORECAST"
Case "I"
ConvertType = "INVOICE"
Case "M"
ConvertType = "FIRM PLANNED MFG ORDER"
Case "F"
ConvertType = "WORK ORDER"
Case "R"
ConvertType = "FIRM PLANNED PO"
Case "P"
ConvertType = "PURCHASE ORDER (RELEASED)"
Case Else
'-- Whatever you want
End Select

End Function

AFAIK there is no practical limit.
Can you give me suggestion on the Select Case structure. I am all for
cleaning it up. I thought the Select Case was limited on the number.
[quoted text clipped - 4 lines]
 

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