Results 1 to 4 of 4
  1. #1
    Mclaren is offline Competent Performer
    Windows 7 Access 2007
    Join Date
    Feb 2010
    Location
    Johannesburg
    Posts
    164

    Inserting text from a function


    I am using Dev Ashish's code for fOSMachinename. I have a text box on a form i want to insert the result into. I am using the following code:

    Code:
     
    Private Sub Form_Open(Cancel As Integer)
    
    Me.CapturedMachine.DefaultValue = fOSMachineName
    
    End Sub
    when navigating to a new record the text box just shows : #name?

    i have never had this issue before.

    Am i missing something ?

    The field : Capturedmachine resides in a back end table, and is a text field.

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    The DefaultValue of a control is a string. Try:
    Me.CapturedMachine.DefaultValue = Chr(34) & fOSMachineName & Chr(34)

  3. #3
    Mclaren is offline Competent Performer
    Windows 7 Access 2007
    Join Date
    Feb 2010
    Location
    Johannesburg
    Posts
    164
    Quote Originally Posted by RuralGuy View Post
    The DefaultValue of a control is a string. Try:
    Me.CapturedMachine.DefaultValue = Chr(34) & fOSMachineName & Chr(34)
    that worked. perfect. But what is Chr(34) ? (i presume its an apostophy quote ?)
    and, why do i need it in my code ?

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    It is actually the DoubleQuote character ("). Try it in the immediate window to see what happens.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. !!Please Please Help!! Inserting my Data
    By dinorbaccess in forum Access
    Replies: 9
    Last Post: 01-08-2011, 05:24 AM
  2. inserting .wav sound?
    By dada in forum Programming
    Replies: 2
    Last Post: 08-20-2010, 11:25 PM
  3. error on inserting value
    By dada in forum Programming
    Replies: 3
    Last Post: 08-18-2010, 11:28 PM
  4. Inserting into a database
    By Cined in forum Programming
    Replies: 1
    Last Post: 04-14-2010, 12:33 PM
  5. Inserting a picture
    By Carenas in forum Forms
    Replies: 0
    Last Post: 01-03-2009, 05:09 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums