Page 2 of 3 FirstFirst 123 LastLast
Results 16 to 30 of 38
  1. #16
    REDandBLACKpack is offline Novice
    Windows Vista Access 2007
    Join Date
    Jul 2011
    Posts
    27
    Quote Originally Posted by rpeare View Post
    if your tables, queries forms are all named the same in your original database you just do the same thing I did, which I explained in the first post.
    I know how to do the exit values but I am not sure how to do that first part. All of the names of the tables, queries, forms are the same

  2. #17
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    what 'first part' you mean adding the unbound combo box? just add a combo box and make the data source the same as I did in my example or just copy the combo box from my example to your form, then you just have to attach the on exit code to it

  3. #18
    REDandBLACKpack is offline Novice
    Windows Vista Access 2007
    Join Date
    Jul 2011
    Posts
    27
    Quote Originally Posted by rpeare View Post
    what 'first part' you mean adding the unbound combo box? just add a combo box and make the data source the same as I did in my example or just copy the combo box from my example to your form, then you just have to attach the on exit code to it
    I am not sure what you meant by copy the combo boc from your example, but i simply copy and pasted it into my form and added the exit code but it is not working. it lists all of the ContractIDs in the search but when it does not refresh it when I click outside of that search box to reflect the changed ContractID

  4. #19
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    then you're not changing the ON EXIT property of the combo box, remember when you copy the combo box from my example to your form it does NOT preserve the name of the combo box so you will have to modify the ON EXIT Property manually

  5. #20
    REDandBLACKpack is offline Novice
    Windows Vista Access 2007
    Join Date
    Jul 2011
    Posts
    27
    Quote Originally Posted by rpeare View Post
    then you're not changing the ON EXIT property of the combo box, remember when you copy the combo box from my example to your form it does NOT preserve the name of the combo box so you will have to modify the ON EXIT Property manually
    I copied all of the code from the ON EXIT property of your example to mine. both are called searchfield.

    This is what is in yours and is working:
    Private Sub searchfield_Exit(Cancel As Integer)
    Me.Requery
    DoCmd.GoToControl ("COUNTERPARTY")
    End Sub

    This is what is in mine and is not working:
    Private Sub searchfield_Exit(Cancel As Integer)
    Me.Requery
    DoCmd.GoToControl ("COUNTERPARTY")
    End Sub

  6. #21
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    go to the design view of the form

    go to your searchfield text box go to the ON CLICK event. does it say [Event Procedure] or is it blank? If it's blank you haven't reestablished the event you want to run so click the three dots to the right your code should already be there, then just close the vb window and it should run as normal. You can't just copy code for events and have it work. You still have to go to the event procedure building portion, even if it automatically finds your code you still have to do it.

  7. #22
    REDandBLACKpack is offline Novice
    Windows Vista Access 2007
    Join Date
    Jul 2011
    Posts
    27
    Quote Originally Posted by rpeare View Post
    go to the design view of the form

    go to your searchfield text box go to the ON CLICK event. does it say [Event Procedure] or is it blank? If it's blank you haven't reestablished the event you want to run so click the three dots to the right your code should already be there, then just close the vb window and it should run as normal. You can't just copy code for events and have it work. You still have to go to the event procedure building portion, even if it automatically finds your code you still have to do it.
    when i first clicked it, it was blank. and then now when i open it my code is there but it still does not work. i am not sure what you mean by the three dots to the right of my code.

  8. #23
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    I don't know what to tell you then, you're doing something differently between the two databases what I would suggest is importing the form that works into the database that doesn't and seeing if the imported form works. If it does there's something different in your database setup. If it doesn't work something else is going on. The three dots appear when you click on the ON CLICK event at the far right hand side of the properties window, that's what you click when you want to build an event.

  9. #24
    REDandBLACKpack is offline Novice
    Windows Vista Access 2007
    Join Date
    Jul 2011
    Posts
    27
    Quote Originally Posted by rpeare View Post
    I don't know what to tell you then, you're doing something differently between the two databases what I would suggest is importing the form that works into the database that doesn't and seeing if the imported form works. If it does there's something different in your database setup. If it doesn't work something else is going on. The three dots appear when you click on the ON CLICK event at the far right hand side of the properties window, that's what you click when you want to build an event.
    i dont see any dots, perhaps it is becuase i am using a different version of access, to build i right click and chose build

  10. #25
    REDandBLACKpack is offline Novice
    Windows Vista Access 2007
    Join Date
    Jul 2011
    Posts
    27
    importing the form does not work. when trying to run it i get an error for Enter Parameter Value: Form!Contracts Form!searchfield!

  11. #26
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    When I right click and choose to build an event it defaults to AfterUpdate. So I'll say it once again, scroll down to your ON CLICK event property of your SEARCHFIELD text box click on that row. Does it say [Event Procedure], does it say nothing, does it say [Event Procedure] in any other event? if it does delete it, click on the ON CLICK event row, three dots will appear on a button to the far right, click THAT button then choose the code option then paste in the code.

    Or as I said import the form that works into your database and see what happens.

  12. #27
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    So your forms are not exactly the same. You've changed the name of either your form or your search field or both at the very least. when you get the parameter value error it's basically telling you it doesn't know how to evaluate

    Form!Contracts Form!searchfield

    this

    if this is exactly how it appears in your code it isn't going to work, access does not like spaces in object names (table names, field names, form names, report names, etc, etc, etc.)

    so try forms![contracts form]![searchfield] but you *must* be sure these object names (text box names) are on your form and that your form is actually called 'contracts form' or you will continue getting the parameter value error.

  13. #28
    REDandBLACKpack is offline Novice
    Windows Vista Access 2007
    Join Date
    Jul 2011
    Posts
    27
    when I go to CLICK in the event property after right clicking and hitting build it shows all of this:
    Private Sub searchfield_BeforeUpdate(Cancel As Integer)
    End Sub
    Private Sub searchfield_Click()
    End Sub
    Private Sub searchfield_Exit(Cancel As Integer)
    DoCmd.GoToControl ("COUNTERPARTY")
    Me.Requery
    DoCmd.GoToControl ("COUNTERPARTY")

    End Sub

    If I dont click on build and click zoom it says [Event Procedure] and nothing else

  14. #29
    REDandBLACKpack is offline Novice
    Windows Vista Access 2007
    Join Date
    Jul 2011
    Posts
    27
    Quote Originally Posted by rpeare View Post
    So your forms are not exactly the same. You've changed the name of either your form or your search field or both at the very least. when you get the parameter value error it's basically telling you it doesn't know how to evaluate

    Form!Contracts Form!searchfield

    this

    if this is exactly how it appears in your code it isn't going to work, access does not like spaces in object names (table names, field names, form names, report names, etc, etc, etc.)

    so try forms![contracts form]![searchfield] but you *must* be sure these object names (text box names) are on your form and that your form is actually called 'contracts form' or you will continue getting the parameter value error.
    all of the names are the same except when i imported in the form it named it Contracts Form1

    I meant to capitalize it in the earlier post about the error. i tried putting what you said into the parameter value and even with contracts Form1 but it does not bring in any info

  15. #30
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    Code:
    Private Sub searchfield_BeforeUpdate(Cancel As Integer)
    
    End Sub
    
    Private Sub searchfield_Click()
    
    End Sub
    
    Private Sub searchfield_Exit(Cancel As Integer)
         DoCmd.GoToControl ("COUNTERPARTY")
         Me.Requery
         DoCmd.GoToControl ("COUNTERPARTY")
    End Sub
    this is three different events.

    one is the BEFORE UPDATE event of your searchfield (which is doing nothing)
    one is the ON CLICK event of your searchfield (which is doing nothing)

    and one is the ON EXIT event of your searchfield in which you're calling your gotocontrol twice.

    so firstly, and for the last time, please, please, please just click on the ON EXIT event of the SEARCHFIELD text box. Click ONCE on the row that says ON CLICK. At the far right hand side of that row a small button will appear that has three dots on it (...). Click that button it should take you to the section of code that says:

    Code:
    Private Sub searchfield_Exit(Cancel As Integer)
         DoCmd.GoToControl ("COUNTERPARTY")
         Me.Requery
         DoCmd.GoToControl ("COUNTERPARTY")
     End Sub
    if it does, remove remove the first DOCMD.GOTCONTROL("COUNTERPARTY")
    if it does NOT then you have not named your searchfield correctly and you have to rename the unbound textbox to SEARCHFIELD, then go back through this same process to attach the code to your ON CLICK event.

    Secondly. If you are getting a parameter value prompt you have NOT named all of your objects the same, either your form name or your unbound text box SEARCHFIELD is no longer named SEARCHFIELD (as mentioned above) and you need to fix those two items.

Page 2 of 3 FirstFirst 123 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 4
    Last Post: 01-14-2016, 02:18 PM
  2. Replies: 3
    Last Post: 10-11-2011, 01:43 PM
  3. Replies: 9
    Last Post: 07-14-2011, 07:20 AM
  4. index/primary cannot contain null value
    By BinHDreW in forum Access
    Replies: 1
    Last Post: 05-26-2011, 08:25 PM
  5. UNION two tables with same primary key values
    By carillonator in forum Queries
    Replies: 1
    Last Post: 02-02-2010, 08:54 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