Results 1 to 5 of 5
  1. #1
    Join Date
    Aug 2015
    Posts
    15
    Provided Answers: 1

    Unanswered: Unable to Display Default Value in Subform Query

    Good day,
    First off, let me say that I have been handed a project and unfortunately have minimal experience with vba, however, everyone here has been extremely helpful solving issues as they come up and I am forever grateful. The project is coming together well but I need another bit of help as I am stuck.

    I have a query in a subform and Iím trying to get it to display a default value. Iíve tried inputting [FieldName].ItemData(2) in the default value of the property sheet but when I go to a new record the text box is still blank. Iím guessing I might need to identify a specific column but Iím not sure how to go about it. Iím working at understanding sub-forms vs parent-forms. Hopefully itís an easy fix.
    Cheers and thank you.

  2. #2
    Join Date
    Feb 2004
    Location
    New Zealand
    Posts
    1,424
    Provided Answers: 8
    Default values are added to the table after everyting else

    but you could use

    you should put in the OnCurrent Sub
    if Me.Dirty then
    'its a new record
    else
    'not new record
    end if
    hope this help

    See clear as mud


    StePhan McKillen
    the aim is store once, not store multiple times
    Remember... Optimize 'til you die!
    Progaming environment:
    Access based on my own environment: DAO3.6/A97/A2000/A2003/A2007/A2010
    VB based on my own environment: vb6 sp5
    ASP based on my own environment: 5.6
    VB-NET based on my own environment started 2007
    SQL-2005 based on my own environment started 2008
    MYLE
    YOUR PASSWORD IS JUST LIKE YOUR TOOTHBRUSH DON'T SHARE IT.

  3. #3
    Join Date
    Aug 2015
    Posts
    15
    Provided Answers: 1
    Good day myle,
    Again, thanks to you and everyone at dbForums for the great assistance... especially to someone as lost in vba as I am

    Here is the code I tried to use but no joy. When I go to a new record, the sub-form text box is still blank. For default value in the property sheet I have entered [Description].ItemData(2) with ďDescriptionĒ being the field name. Any idea where Iím going wrong???
    Private Sub Form_Current()
    If Me.Dirty Then
    'its a new record
    Else
    'not new record
    End If
    End Sub

  4. #4
    Join Date
    Feb 2004
    Location
    New Zealand
    Posts
    1,424
    Provided Answers: 8
    did you try a msgbox

    let see if we are getting what we want


    Code:
    Private Sub Form_Current()
    if me.dirty then
    msgbox("NEW Record" & vbnewline &  Me.Description.ItemData(2))
    
    else
    
    End If
    End Sub
    hope this help

    See clear as mud


    StePhan McKillen
    the aim is store once, not store multiple times
    Remember... Optimize 'til you die!
    Progaming environment:
    Access based on my own environment: DAO3.6/A97/A2000/A2003/A2007/A2010
    VB based on my own environment: vb6 sp5
    ASP based on my own environment: 5.6
    VB-NET based on my own environment started 2007
    SQL-2005 based on my own environment started 2008
    MYLE
    YOUR PASSWORD IS JUST LIKE YOUR TOOTHBRUSH DON'T SHARE IT.

  5. #5
    Join Date
    Aug 2015
    Posts
    15
    Provided Answers: 1
    Good day myle,
    My apologies for the delay in responding... I'm on a ship and the connectivity is terrible. I've tried your latest recommendation and unfortunately it's not generating what we need. I'm at a complete loss and its disheartening. I did notice in the property sheet that the Row Source Type is a Table/Query... would that impact what I'm trying to do? Also, does it matter that that the field is a combo box??

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
  •