Page 1 of 2 12 LastLast
Results 1 to 15 of 30
  1. #1
    dotan is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Feb 2011
    Posts
    13

    how do i open a query\form from a listbox


    well ill try the best i can to explain whats my problem and because im pretty new in this subject (started to lern it just this year in school) go easy on me
    well in my project im runing a robot lab which we fix robot's for clinets (thats what the teacher decided) and i have a clinets form and what i wanted to do is to navigate to a clinet in this form by writing he's id number in a listbox
    so i dont know if how i did it was wrong or no but i didnt get any results so can you please guide me how to navigate to a clinet by writing he's name on a listbox on the clinet form?
    im sorry for my bad english hope you understand

  2. #2
    TheShabz is offline Court Jester
    Windows XP Access 2003
    Join Date
    Feb 2010
    Posts
    1,368
    You don't write an ID in a listbox, usually. It would be a textbox. I'll assume you meant textbox.

    Once you have that, in your query, in the criteria section for ID, put in: Forms!formName!txtBoxName
    Replacing formName and txtBoxName with the names that apply to your form and textbox.

    I highly doubt the teacher wants you to use a listbox for this as it's both impractical as well as not for beginners. You would have to go in and use VBA to work out what was selected. Not good times.

  3. #3
    dotan is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Feb 2011
    Posts
    13
    well i didnt quite get it so im going to explain my self in images (yea thats how dumb i am)
    thats my form and where i circle is where i want to write an id and from there to navigate to another clinet in the form

    and thats my query and i circled where you told me to write, true?

  4. #4
    TheShabz is offline Court Jester
    Windows XP Access 2003
    Join Date
    Feb 2010
    Posts
    1,368
    Correct. That is where you would write it. However, I have never worked with a non-English version so I dont know if anything changes. I know in English you would put into the yellow box:
    Forms!formName!txtBoxName
    Again, replacing formName and txtBoxName with the proper names and leaving Forms as-is.

  5. #5
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    don't listen to Shabz. There are no such things as yellow boxes on forms. He doesn't know what he's talking about. He's young and inexperienced.

    (just kidding, bud!). good luck with this one!

  6. #6
    TheShabz is offline Court Jester
    Windows XP Access 2003
    Join Date
    Feb 2010
    Posts
    1,368
    The "Young and inexperienced" vibe works great on cougars.

  7. #7
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    Quote Originally Posted by TheShabz View Post
    The "Young and inexperienced" vibe works great on cougars.
    careful bud. don't cross the line here. There are still Admins and Mods here you know. Oh wait...I get it...you were talking about the animal. Yes, you're right!

  8. #8
    TheShabz is offline Court Jester
    Windows XP Access 2003
    Join Date
    Feb 2010
    Posts
    1,368
    Aww cmon. This isn't Microsoft Tech Support. We can have a LITTLE side talk =P

  9. #9
    dotan is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Feb 2011
    Posts
    13
    im felling dumb once agian i got cunfused between a listbox to textbox
    what i circled you in blue is a textbox or a listbox?
    any way i tried to write it in the query but i dont know what do next to navigate...

  10. #10
    TheShabz is offline Court Jester
    Windows XP Access 2003
    Join Date
    Feb 2010
    Posts
    1,368
    I'm not sure what it is. It could be either one. You put it there. As far as navigation, it depends on how you want the data displayed. Are they supposed to go in the other fields on the form? Would you like them in a subform? It's your call really. If the other fields, you would most likely use the DLookup() function (Google is your friend) or if subform, you simply bind your query to the subform and have it update from there.

  11. #11
    dotan is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Feb 2011
    Posts
    13
    i want it to navigate in the form and go to another filed' a filed of another clinet which i typed his id number
    about this DLookup() this man says i need VBA knoldge which i dont have so i dont quite know what to do...
    and agian to the text\list which one of those are each?

    im sorry if my ignorance ruined your day

  12. #12
    TheShabz is offline Court Jester
    Windows XP Access 2003
    Join Date
    Feb 2010
    Posts
    1,368
    You haven't ruined my day in the least. You've kept me from being bored out of my mind waiting for queries to run at work. The one on the left is a label. The one on the right is a textbox. Neither of which are listboxes, which are usually used to create a list and choose from one or more of the options.

    The DLookup does not need to be used in VBA. you can insert it directly into the textbox you wish to display the data. Lets say for example, we have a query called "query1" that has a field called "Name". Also, the form has a textbox you wish to display the data in called "txtName".

    Now, you go on txtName and enter in:
    =DLookup("Name", "query1")

    The only VBA you will need is a button you press after entering in the ID number. In the Event tab of the button's properties box, click the ... next to OnClick and the VBA window will open up looking like

    Code:
    Option Compare Database
    
    Private Sub Button1_Click()
    
    
    
    End Sub
    Between the Private Sub... and End Sub enter in
    Me.Requery

    THATS IT! Save it and every time you enter in an ID and click the button, it should update the other fields with the proper data using DLookup.

  13. #13
    dotan is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Feb 2011
    Posts
    13
    i cant use VBA because we didnt get this far and i gess it will be cheating or somthing that irrational teacher will say...
    and i didnt got were exclay i need to write the dlooup

  14. #14
    TheShabz is offline Court Jester
    Windows XP Access 2003
    Join Date
    Feb 2010
    Posts
    1,368
    Going above and beyond is never cheating. I used VBA in my first Database course. If you're not allowed to use VBA, there's no purpose in using MS Access, IMO. But I digress. the DLookup would go in the textbox that you wish to display data in. Just click inside it in design view (not form view) so that you can type in it. Then type in what I wrote above, changing whatever you need to make it fit your form and query.

  15. #15
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    Quote Originally Posted by TheShabz View Post
    Going above and beyond is never cheating.
    or you could switch degree programs, if this is proving to be way too complex.

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

Similar Threads

  1. Form ListBox Know-how
    By InThrees in forum Forms
    Replies: 5
    Last Post: 12-03-2010, 01:02 PM
  2. Replies: 2
    Last Post: 02-26-2010, 08:14 AM
  3. Open form based on query results
    By RobbertH in forum Queries
    Replies: 1
    Last Post: 02-10-2010, 08:13 AM
  4. Query criteria retrieved from a Form's listbox
    By blacksaibot in forum Programming
    Replies: 1
    Last Post: 01-29-2010, 10:38 AM
  5. Open a form using a query that references a combo
    By accessbobp646 in forum Access
    Replies: 1
    Last Post: 02-22-2009, 09:50 AM

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