Results 1 to 15 of 15
  1. #1
    burrina's Avatar
    burrina is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2012
    Location
    Freeport,Texas
    Posts
    1,383

    Syntax Error Making One Field Equal Another

    I have a field on my form that needs to stay the same even if moving to another record,it is a bound field and the name is Bank.


    Here is my code that runs on the OnCurrent Event.
    [Me].[Bank].[DefaultValue]="""" & [Me].[Bank].[Value] & """"

    I tells me invalid use of dot or operator or parenthesis.
    Maybe another way to do this but I am coming up blank.

  2. #2
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows XP Access 2003
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,610
    Quote Originally Posted by burrina View Post
    I have a field on my form that needs to stay the same even if moving to another record,it is a bound field and the name is Bank.
    Can you explain the need for this.
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  3. #3
    burrina's Avatar
    burrina is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2012
    Location
    Freeport,Texas
    Posts
    1,383

    Maybe This Will Help

    I have a Check Register Database and need to maintain the Same Bank Account for all records entered onto the Check Register.Only ONE Bank Account to be used at a time on the register. If I go to the next record it show me whatever next Bank Account there is and I don't want this. The table the register is based on uses a combo lookup for the Bank to be used on the form. Bank field is in another table named TBanks. Check Register table is named TReg. Here is a screenshot of the Check Register, move to new record, new bank,,,BAD!

    It is a Continuous Form,sorry, forgot that.
    Attached Thumbnails Attached Thumbnails CheckRegister.jpg  
    Last edited by burrina; 01-01-2013 at 11:28 AM. Reason: Picture,One More Thing.

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,642
    Try without the brackets around Me.

    http://access.mvps.org/access/forms/frm0012.htm
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    burrina's Avatar
    burrina is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2012
    Location
    Freeport,Texas
    Posts
    1,383
    I was using this as the Default Value of the control Bank [Me].[Bank].[DefaultValue]="""" & [Me].[Bank].[Value] & """"
    It puts the brackets back if I try and change it.

    I use this code on the forms OnCurrent Event
    Me.Bank.DefaultValue = """" & Me.Bank.Value & """"


    Bank still changes when moving to next record. I should be able to keep the same Bank for all record entered into the check register but
    can't for the life of me figure out how. Only ONE Bank per check register is what I am after.

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,642
    Try the after update event of the bank control. I think the current event is too late.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  7. #7
    burrina's Avatar
    burrina is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2012
    Location
    Freeport,Texas
    Posts
    1,383
    Nope, same thing. Continuous forms are a pain!!! Can't do it in Datasheet, too much code to try and rewrite. I even separated the tables and made one just the details and linked by RegID and no luck. I a sure I am missing something simple, at least I hope i am.

  8. #8
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,642
    Is there some other code running to populate that value? Can you post the db here?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  9. #9
    burrina's Avatar
    burrina is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2012
    Location
    Freeport,Texas
    Posts
    1,383
    Anyway to post privately? This is not one I want to give away! At least not right now.My plan is to try and sell small databases as a source of income. I realize it is hard to get a grip on what I am doing without seeing it! Most of you guys could no doubt write something much better in a much smaller amount of time but not many people on here offer up their database for free. it is almost impossible as well to scale down and allow you or anyone to make sense of it. Maybe it is my basic design? So, there is what I will do if I don't hear back from you. I will post and then delete it after a short wait. Hope you understand! If I were getting paid to write this, I would owe them money.

  10. #10
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,642
    If you want to email it

    Pbaldy
    gmail
    com
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  11. #11
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    You keep speaking of 'going to next record.' What you want to do should only be done when going to a New Record! Otherwise you'll be over-writing an existing Record! Following Paul's suggestion

    Code:
    Private Sub Bank_AfterUpdate()
     Me.Bank.DefaultValue = """" & Me.Bank.Value & """"
    End Sub

    will insert the Current Record's Bank data into each New Record until it is physically changed or the Form or Access itself closed.

    Linq ;0)>

  12. #12
    burrina's Avatar
    burrina is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2012
    Location
    Freeport,Texas
    Posts
    1,383
    Here's the thing though, when I go to a new record, it no longer shows what Bank account i am using, that wont work! I need to stay with the same bank account for all records associated with it. Each instance of the check register should have its bank account.

  13. #13
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    Don't know what to tell you if you're not willing to post your file here! Assuming that other code works, i.e. your file is in a Folder that has been declared as 'Trusted,' it should work! That code is standard boilerplate and has worked for literally thousands of developers over the years!

    Linq ;0)>

  14. #14
    burrina's Avatar
    burrina is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2012
    Location
    Freeport,Texas
    Posts
    1,383

    Scheduler and Append Query Screenshots

    Thanks for the offer and help. Will post back after trying a few things. What I am doing I think is unique amongst everything I have seen. I have seen nothing to date that does it, Quicken, Quickbooks, MyCheckbok and so on all do it but have not seen a Access db that does it. I have a scheduler incorporated in it as well. If your willing to take a shot at this other thing I am trying I would appreciate it. On my scheduler form which uses a EventID as the primary key I need to append the date to the table TReg which has a Primary key of RegID. It wants to append to all the records instead of just one. Here is my append code.

    If Me.Dirty Then Me.Dirty = False
    DoCmd.SetWarnings False 'Purpose: Append Scheduled Trans To Check Register.
    DoCmd.OpenQuery "Qappendtoregister"
    DoCmd.RunCommand acCmdSaveRecord
    If Me.Dirty Then Me.Dirty = False
    DoCmd.SetWarnings True
    __________________________________________________ _________________________________
    The ONLY criteria the query has is for the field enter which is set to Date() that's it. I am thinking I need a where statement or something, just dont know how to implement it. See attached screenshot of append query and scheduler form. Any suggestions without seeing it?
    Attached Thumbnails Attached Thumbnails schedulerform.jpg   appendquery.jpg  

  15. #15
    burrina's Avatar
    burrina is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2012
    Location
    Freeport,Texas
    Posts
    1,383
    Giving up on this one. Thanks...

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

Similar Threads

  1. Replies: 2
    Last Post: 03-08-2013, 12:59 PM
  2. Replies: 11
    Last Post: 10-18-2012, 02:23 PM
  3. Calculated field with NOT Equal issue
    By kbassnac in forum Queries
    Replies: 8
    Last Post: 04-20-2011, 07:11 AM
  4. Replies: 5
    Last Post: 09-17-2010, 09:48 PM
  5. Incomplete Syntax Clause (syntax error)
    By ajetrumpet in forum Programming
    Replies: 4
    Last Post: 09-11-2010, 10:47 AM

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
  •  
Other Forums: Microsoft Office Forums