Results 1 to 5 of 5
  1. #1
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    austin, Texas, USA
    Posts
    1,029
    Thanks
    0
    Thanked 0 Times in 0 Posts

    A little stuck on a design implementation (Access2

    I am assembling an Access front-end to SQL Server and am trying to put together a form that searches SQL Server for a match based on Entity_TIN, and was thinking of having the results show in a subform. Of course, the main form's search textbox is unbound and Access can't link a subform to a form control that is unbound. Is there a way to set the link in code? Is this a good idea? My thinking is, setup a search in code; if there's a match set the subform to visible and and linked to the value in the search box. I'm not thrilled with the idea of having a subform that isn't necessarily linked to a good value (like it would be if the search fails or when the form initial loads) but I'd like to display the search results in the same form, if possible.

    TIA

    <img src=/S/compute.gif border=0 alt=compute width=40 height=20>

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 28 Times in 28 Posts

    Re: A little stuck on a design implementation (Access2

    Since the search text box is unbound, you can't use the builder (the ... button) to specify the link fields, but you can set them manually. The subform will be updated automatically when the text box is updated (not while the user is typing an entry). If the user enters a value without matches, the subform will be empty. Depending on the number of Entity_TIN values, you could use a combo box instead of a text box, so that the user can only select valid entries.

  3. #3
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    austin, Texas, USA
    Posts
    1,029
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: A little stuck on a design implementation (Acc

    I have gotten something that kind of works after more trolling and using some of your code (of course!). I attached the VBA to a button but will look at attaching it to an event, such as tabbing out of the search text box. Also when the form initially opens the subform shows all the records in the search table, which I'm not keen on.

    I can't use a drop-down as I am searching for an Entity_ID that may not be in the source data. Validation will come next (or almost next) once I get the form behaviour to work as intended.

    One thing, not related to this project, but something I find annoying -- how do you tell access what sub you want to use for an event? Access will create a new sub shell with it's own name using the wizard and I'm not aware of how to specify VBA when attaching an event. I end up cutting/pasting and using Access's name for the event sub.

    Thanks! <img src=/S/bow.gif border=0 alt=bow width=15 height=15>

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 28 Times in 28 Posts

    Re: A little stuck on a design implementation (Acc

    > how do you tell access what sub you want to use for an event?

    Not. Event procedure names are fixed. (You can enter an expression directly in the event box in the Properties window, such as =MyClickHandler(). This must refer to a function. This doesn't work very well if you need to manipulate the arguments for the event procedure.)

  5. #5
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    austin, Texas, USA
    Posts
    1,029
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: A little stuck on a design implementation (Acc

    ok. i guess "this behaviour is by design".

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •