Results 1 to 6 of 6
  1. #1
    angie is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Dec 2013
    Posts
    232

    DLookUp not working in the event statment

    I am usingthis event after change on a combo box. I am trying to use the DLookUp because the proposaldescriptiong wasbeing cut off and not everything was showing in the field.
    But I am getthe error : syntax error (missing operator) in query expression systemID=2ton 15 seer single. If I delete theme.propsaldescription line everything works great but I need it to fill thisalso on change.


    Private Sub System_Change()
    Me.Ton =Me.System.Column(2)
    Me.Seer =Me.System.Column(3)
    Me.HPModel =Me.System.Column(4)
    Me.FuranceModel= Me.System.Column(5)


    Me.CoilModel= Me.System.Column(6)
    Me.HeaterKitModel= Me.System.Column(7)
    Me.HeaterKW= Me.System.Column(8)
    Me.TXVModel= Me.System.Column(9)
    Me.ThermostatModel= Me.System.Column(10)
    Me.SystemDescription= Me.System.Column(11)
    Me.FinancedPrice= Me.System.Column(13)
    Me.EstPayments= Me.System.Column(14)
    Me.CashPrice= Me.System.Column(15)
    Me.ProposalDescription= DLookup("proposaldescription", "[proposal query]","systemid=" & Me.System.Column(1))


    SELECTSystems.SystemID, [Systems]![Ton] & " TON " & [Systems]![Seer] & "SEER " & [Systems]![Stage] ASSystem, Systems.Ton, Systems.Seer, Systems.HPModel, Systems.FuranceModel,Systems.CoilModel, Systems.HeaterKitModel, Systems.HeaterKW, Systems.TXVModel,Systems.ThermostatModel, Systems.SystemDescription, Systems.ProposalDescription,Systems.FinancedPrice, Systems.EstPayments, Systems.CashPrice
    FROMSystems;

  2. #2
    isladogs's Avatar
    isladogs is offline Access MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    6,204
    If the systemid is a text field, you need text delimiters
    Code:
    "systemid='" & me.system.column(1) & "'"
    but why is the field being truncated. is it a memo field? Are you using formatting like @ on the field?
    Colin Riddington, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I know I don't know, I keep quiet!

  3. #3
    angie is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Dec 2013
    Posts
    232
    Its a memo field
    Where do I put the above code?

  4. #4
    Gicu's Avatar
    Gicu is offline VIP
    Windows 8 Access 2013
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,250
    I would suggest moving the code to the AfterUpdate event of the combo box as the Change event triggers for every keystroke. I take it you know the Column property is zero-based -so if you want the first column is System.Column(0).

    Cheers,
    Vlad

  5. #5
    isladogs's Avatar
    isladogs is offline Access MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    6,204
    Use that code in your Dlookup line
    Or fix the truncation issue and use the appropriate column of your combo.

    Agree with gicu. Move code to after update event
    Colin Riddington, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I know I don't know, I keep quiet!

  6. #6
    angie is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Dec 2013
    Posts
    232
    Thank you, I did as you said and moved it to after update event and corrected the code and it works great thank you again

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

Similar Threads

  1. Event Code Not Working
    By angie in forum Access
    Replies: 2
    Last Post: 04-03-2018, 11:53 AM
  2. BeforeInsert Event Not Working
    By wtucker in forum Forms
    Replies: 4
    Last Post: 10-19-2017, 02:00 PM
  3. On Delete Event Not Working
    By pdowg881 in forum Access
    Replies: 2
    Last Post: 05-21-2015, 11:18 AM
  4. PLEASE HELP! Dlookup event not working....
    By emailloni in forum Forms
    Replies: 11
    Last Post: 01-10-2013, 12:43 PM
  5. if statment or case statment?
    By whojstall11 in forum Forms
    Replies: 4
    Last Post: 07-09-2012, 01:44 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