Consulting

Results 1 to 3 of 3

Thread: MAINTAINING FORMAT

  1. #1
    VBAX Regular
    Joined
    Nov 2018
    Posts
    41
    Location

    MAINTAINING FORMAT

    Dim dbs As DAO.Database
    Dim rst As DAO.Recordset2
    Dim rst1 As DAO.Recordset2
    Dim temp

    'Get the database, recordset, and attachment field
    Set dbs = CurrentDb
    Set rst = dbs.OpenRecordset("SELECT ALLOCATION, AMOUNTs, REMARKS FROM [DEPARTMENT & ALLOCATION] WHERE [CR NO]='" & CRNO & "'")

    Do Until rst.EOF
    Set rst1 = dbs.OpenRecordset("SELECT MEANING FROM [ALLOCATION] WHERE [ALLOCA]='" & rst("ALLOCATION") & "'")
    'For each item, get the Allocation and Amount details.
    9 temp = temp & rst1("MEANING") & " Rs." & rst("AMOUNTs") & " " & rst("REMARKS") & "; "
    'MsgBox Temp
    ' Move to the next order item (if there is one).
    15 rst.MoveNext
    16 Loop

    AMOUNTs is in Currency format, but when it is transferred to temp it loses its Currency format. What to do so that it maintains its Currency format even after being transferred to temp

  2. #2
    Quote Originally Posted by Kundan View Post
    Dim dbs As DAO.Database
    AMOUNTs is in Currency format, but when it is transferred to temp it loses its Currency format. What to do so that it maintains its Currency format even after being transferred to temp
    Use Format(rst("AMOUNTs"),"Currency") when retrieving the value to the temp string.
    Learn VBA from the ground up with my VBA Online Courses.

  3. #3
    VBAX Regular
    Joined
    Nov 2018
    Posts
    41
    Location
    Quote Originally Posted by PhilS View Post
    Use Format(rst("AMOUNTs"),"Currency") when retrieving the value to the temp string.

    Thanks a lot! GOD BLESS YOU!!!!!!!!!!

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •