Re: Need VBA Code

Tech-Archive recommends: Fix windows errors by optimizing your registry



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
>


.



Relevant Pages

  • Re: Populating the data of two Textboxes into One textbox
    ... how does it differ from what you're expecting? ... > Public Function CalculateFindingNo(Val1 As String, ... > I am calling in the AfterUpdateEvent of txtbox2 ... > Its not working folks ...
    (microsoft.public.access.forms)
  • Re: Update DB table from visual basic script
    ... Dim dbs As Database ... Public Function UpdateDB(dbName As String) As Boolean ... Public Function updateDB_fnameAs Boolean ... On Error Resume Next ' if proc does not exist then return blank string ...
    (comp.databases.ms-access)
  • Load registry hive (AdjustTokenPrivileges error)
    ... Public PrivilegeCount As Int32 ... Public Function RegLoadKey(ByVal hKey As Int32, ... String, ByVal lpFile As String) As Int32 ... Dim strKeyName As String ...
    (microsoft.public.vb.winapi)
  • Load registry hive (AdjustTokenPrivileges error)
    ... Public PrivilegeCount As Int32 ... Public Function RegLoadKey(ByVal hKey As Int32, ... String, ByVal lpFile As String) As Int32 ... Dim strKeyName As String ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Help creating object in excel VBA
    ... Dim confirm, sent As Boolean ... Dim rowColArrayAs String ... ' TODO: Call CreateEmailMsg ... Public Function GetApptRecAs String, ...
    (microsoft.public.excel.programming)