Page 1 of 2 12 LastLast
Results 1 to 15 of 25
  1. #1
    Computer202 is offline Novice
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    Lincolnshire, ENGLAND
    Posts
    25

    Post How to ADD integer (vba)

    Is there a bit of code I can add to a report LoadEvent which simple adds 1 to my text box "Text33".

    Every time the report is opened I want that number in the text box to increase by 1 Creating a unique number every time



    Starting value: 1

    Dan

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    You realize the textbox would have to be bound to a table to save the value? I assume you mean a textbox on a form:

    Forms!FormName.Text33 = Forms!FormName.Text33 + 1
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    Computer202 is offline Novice
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    Lincolnshire, ENGLAND
    Posts
    25
    Cheers for the reply, Had a late night/morning :P

    I didn't know they needed to be bound so I am trying to bound it...

    The problem being this number is not related to anything! I simply want it to count up :P How do I set that up and make sure it is bound?

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2007
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Why not create a System Table for just such values?

  5. #5
    Computer202 is offline Novice
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    Lincolnshire, ENGLAND
    Posts
    25
    well I have tried a normal table with one field (No primary key)
    and i have tried a normal table with 2 fields (one being a primary key)

    I am confused as to what you mean? Could you please expand (I am a novice)

    Thanks

  6. #6
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2007
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    The first table should work just fine. It will only have one record. Set it as the RecordSource of your form.

  7. #7
    Computer202 is offline Novice
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    Lincolnshire, ENGLAND
    Posts
    25
    I have just tried setting the table as the source for the report but none of the other data works after lol... I have set up a query which combines the two but for some reason this does not show any data in the box :P

  8. #8
    Computer202 is offline Novice
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    Lincolnshire, ENGLAND
    Posts
    25
    Just a reminder I am in a report, not a form, This report was based on the table, now its based on the query :P

  9. #9
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2007
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    You want a TextBox on a *Report* to remember what number it contains when you run the report again? I doubt you will get there, sorry.

  10. #10
    Computer202 is offline Novice
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    Lincolnshire, ENGLAND
    Posts
    25
    Kinda of yes. I don't mind making a table for it I just don't know how? I have tried linking it but no luck and the load up code doesn't seem to work for reports

  11. #11
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2007
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Maybe Paul (pbaldy) will have some ideas for you.

  12. #12
    Computer202 is offline Novice
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    Lincolnshire, ENGLAND
    Posts
    25
    right thanks, I will drop him a line

  13. #13
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2007
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Paul is subscribed to this thread so he sees what we have been talking about. Nothing else is needed to let him know.

  14. #14
    Computer202 is offline Novice
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    Lincolnshire, ENGLAND
    Posts
    25
    damn too late :| I am soooo impatient!

  15. #15
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    I assume since the thread is marked solved that you sorted it out?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 3
    Last Post: 04-12-2009, 05:11 PM
  2. Replies: 1
    Last Post: 10-09-2008, 04:48 AM
  3. Replies: 1
    Last Post: 06-09-2006, 05: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