Re: Need VBA Code
- From: "Allan Murphy" <allanmurphy@xxxxxxxxxxxxxx>
- Date: Wed, 11 Jan 2006 07:34:04 +1100
What is your result in txtbox3
What values are you passing in, is txtbox2 in a date format
I have changed your code slightly so that the record component of your
output will always be same length not 1 10 100 etc. but 00001,00010,00100
etc.
Public Function CalculateFindingNo(Val1 As String, Val2 As Date, RecNo As
Long) As String
CalculateFindingNo = Val1 & Val2 & Format(RecNo, "00000")
End Function
I suggest you start by removing vale2 and val3 from your code and then pass
in txtbox1 and check the result and then add txtbox2 and then recno etc.
Allan Murphy
Email: allanmurphy@xxxxxxxxxxxxxx
"FA" <October.April@xxxxxxxxx> wrote in message
news:1136913397.558356.207040@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> Dim Val1 As String
> Dim Val2 As Date
> Dim Val3 As String
>
> Combine Val1Val2 and return a single value Val3 As String
>
> With Val3 Add 001 for the first record 002 for the second record and so
>
> on
> insert Val3001 into a texbox
> So for Example if Val1 = ABCDE, Val2 = 01/01/2006
> Val3 shoule be = ABCDE01/01/2006001 --- for the first recode (or for
> the first time)
>
>
> I have created the following funtion
>
> Public Function CalculateFindingNo(Val1 As String, Val2 As Date, RecNo
> As Long) As String
> CalculateFindingNo = Val1 & Val2 & RecNo
> End Function
> I have three textboxes --- txtbox1 (Val1) , txtbox2 (Val2),
> txtbox3(Val3)
> In the afterupdate event of txtbox2 i have
> Me.txtbox3 = CalculateFindingNo (me.txtbox1, me.txtbox2, RecNo)
>
> Its not working Pal
>
> Pleae someone help me
>
> Moe
>
.
- References:
- Need VBA Code
- From: FA
- Re: Need VBA Code
- From: fredg
- Re: Need VBA Code
- From: FA
- Need VBA Code
- Prev by Date: Re: Is it possible to embed a report within a form?
- Next by Date: Re: picture on form
- Previous by thread: Re: Need VBA Code
- Next by thread: Re: Form is filtering on opening
- Index(es):
Relevant Pages
|