Results 1 to 14 of 14
  1. #1
    Z1nkstar's Avatar
    Z1nkstar is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Mar 2014
    Location
    TX, USA
    Posts
    145

    Compile Error Can someone HELP

    I have a database that has multiple records I added two click buttons and added code so that they can move records up or down depending upon when I need them moved.
    Here are some snapshots of the code and the buttons.


    Click image for larger version. 

Name:	a.JPG 
Views:	11 
Size:	139.4 KB 
ID:	16094Click image for larger version. 

Name:	b.JPG 
Views:	11 
Size:	68.9 KB 
ID:	16095Click image for larger version. 

Name:	c.JPG 
Views:	11 
Size:	111.3 KB 
ID:	16096

  2. #2
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    is the screenshot of your form a subform, or part of the main form?
    What is the error message you're getting?

    I don't use bound forms at all but I did some very basic testing and was able to get expected results in both a continuous main form and continuous subform arrangement and did not receive an error.

  3. #3
    amrut is offline Expert
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2012
    Location
    Dubai
    Posts
    614
    I have a database that has multiple records I added two click buttons and added code so that they can move records up or down depending upon when I need them moved.
    Here are some snapshots of the code and the buttons.
    Why do you need to move the records, you can use the Orderby property to sort the records the way you want.

  4. #4
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    my guess is that he's got some sort of manufacturing process and he wants to reorder the steps on the fly and the only way to do that is to assign them a priority within a particular job.

  5. #5
    Z1nkstar's Avatar
    Z1nkstar is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Mar 2014
    Location
    TX, USA
    Posts
    145
    Well each day I log on there are certain users that can change it one of them reorders the records to the daily que and most of the orders need to be reordered differently everyday and this form is a subform.
    I copied the buttons from another form is that my problem?

    the error im getting is this,Click image for larger version. 

Name:	dddd.JPG 
Views:	7 
Size:	94.2 KB 
ID:	16098

  6. #6
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    so what happens if you comment the setfocus line out?

    What behavior are you trying to accomplish.

    When you click the 'move up' button you want the renumbering to occur but then what?

    Stay on the 'current' record (stay on the step labeled 3 after the resorting)
    Move to the 'adjusted' record (if a sort currently says 2 and you change it to 1, move to the 1 record)

    Do you have a primary key for the table containing the items in the subform? Have you tried referencing records using the PK? What are you trying to accomplish with the line me.designsort.setfocus? if you're attempting to move to a specific field on the 'current' record you can use docmd.gotocontrol "SetFocus".

  7. #7
    Z1nkstar's Avatar
    Z1nkstar is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Mar 2014
    Location
    TX, USA
    Posts
    145
    Well on this subform what i have made them do was whatever the record is it moves up here are some snap shotsClick image for larger version. 

Name:	abcdefghjklmnop.JPG 
Views:	7 
Size:	62.1 KB 
ID:	16099Click image for larger version. 

Name:	abcdefghijklmnop.JPG 
Views:	7 
Size:	95.1 KB 
ID:	16100

  8. #8
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    isn't that the functionality you're looking for? Looks to me like you changed the order correctly. Or are you saying that you want your cursor to stay on the item with SORT 2 after the sort is complete? I don't understand what the issue is based on your screenshot looks like the sorting is happening correctly.

  9. #9
    Z1nkstar's Avatar
    Z1nkstar is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Mar 2014
    Location
    TX, USA
    Posts
    145
    Well you see those screen shot are from another subform that also has the same coding as this one it just wont work on this one I can't figure it out. they are exactly the same nothing different just the information that is in the form is different. but everytime i press up or down on the subform with the compile error it wont work.

  10. #10
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    how about creating a sample database (copy your database and clear out any private information, but leave enough fake data in to mimic your problem) then compact/repair and zip it up and load it to this site.

  11. #11
    Z1nkstar's Avatar
    Z1nkstar is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Mar 2014
    Location
    TX, USA
    Posts
    145
    okay here you goDLDB Desktop.zip

  12. #12
    John_G is offline VIP
    Windows XP Access 2003
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    Hi -

    I think it is a simple answer -

    Me.DesignSort.Setfocus should be me!Designsort.SetFocus, using ! instead of a period.

    Ms Access can be very fussy at times about when you do and do not have to use ! to indicate a form control or a recordset field, and I suspect this is one of them.

    HTH

    John

  13. #13
    Z1nkstar's Avatar
    Z1nkstar is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Mar 2014
    Location
    TX, USA
    Posts
    145
    okay i guess it didnt work how can i add files?

  14. #14
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    you go through the attachment wizard in the GO ADVANCED button at the bottom right of your post.

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

Similar Threads

  1. Replies: 7
    Last Post: 07-24-2013, 02:01 PM
  2. Compile Error: Syntax Error in DoCmd.RunSQL Statement
    By Evilferret in forum Programming
    Replies: 1
    Last Post: 08-27-2012, 12:32 PM
  3. Replies: 2
    Last Post: 06-23-2012, 11:59 PM
  4. Replies: 7
    Last Post: 06-08-2012, 09:55 PM
  5. Replies: 6
    Last Post: 09-28-2011, 09:20 PM

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