Insert unbound form fields to table

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kadishzm
    New Member
    • Jan 2014
    • 11

    Insert unbound form fields to table

    Hello, I am trying to run a query that will help me insert unbound form fields to a database table. I have basically created a form that will allow users to select the columns (with tons of help from you guys) and would now like to have a main form that will input new search parameters as a record that can be queried later to rerun previous reports. All of my checkbox fields are being inserted into the table but it seems to be treating my text boxes as parameters. How can I get this query to work without converting textbox fields to parameters in the process? The code that I am using is below:


    Code:
    InsSQL = "INSERT INTO tbl_setup_detail ([RunID], [Template], [filename], [split_field], [LaneID], [RefNum], [OFacility], [OCity], [OState], [OZip], [ORegion], [OCountry], [DFacility], [DCity], [DState], [DZip], [DRegion], [DCountry], [Distance], [AnnualVol], [CarName], [CarRef], [Mode], [Equip], [EquipSize], [OrBid], [OrRateType], [OrMinChge], [OrTotalRate], [AssetType], [AllocAmount], [RateGuideSeq], [AwardType]) " & _
         "VALUES (" & _
         Me.txtRunID & _
         "," & Me.txtTemplate & "," & Me.txtFilename & "," & Me.txtSplitfield & "," & Me.ckLaneID & "," & Me.CkRefNum & "," & Me.CkOfacility & "," & Me.CkOCity & _
         "," & Me.CkOState & "," & Me.ckOZip & "," & Me.ckOregion & "," & Me.ckOCountry & "," & Me.ckDFacility & "," & Me.ckDCity & "," & Me.ckDState & "," & Me.ckDZip & _
         "," & Me.ckDRegion & "," & Me.ckDCountry & "," & Me.ckDistance & "," & Me.ckAnnualVol & "," & Me.ckCarName & "," & Me.ckSCAC & "," & Me.ckTransMode & _
         "," & Me.ckEquip & "," & Me.ckEquipSize & "," & Me.ckOrBid & "," & Me.ckRateType & "," & Me.ckMinChge & "," & Me.ckTotalRate & "," & Me.ckAssetType & _
         "," & Me.ckAllocAmount & "," & Me.ckRouteGuideSeq & "," & Me.ckAwardType & ");"
    
    Debug.Print InsSQL
    
    CurrentDb.Execute (InsSQL)
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    Textboxes hold strings and strings need to be encapsulated in quotes.

    Comment

    Working...