Results 1 to 6 of 6
  1. #1
    4 Star Lounger
    Join Date
    Sep 2002
    Location
    Stafford, Staffordshire, England
    Posts
    585
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Textbox value from query (A2K)

    I have a database which stores data about formula 1 races. The main data entry form contains, among others, a combobox which displays a list of Grand Prix circuits and a textbox (tboCountry) in which I wish to display the country associated with the circuit. I have constructed a query (qryCountry) which correctly shows a country based on the circuit selected from the combobox (cboCircuit).
    I have placed this code in the on click event procedure of cboCountry:

    Forms!Results!tboCountry = qryCountry.Country

    This throws up an error - Object required.
    I'd be grateful for someone's help with the syntax.

    Cheers

    Rob
    <font color=blue><font face="Script MT Bold"><big>Rob</big></font face=script></font color=blue>

  2. #2
    4 Star Lounger
    Join Date
    Sep 2002
    Location
    Stafford, Staffordshire, England
    Posts
    585
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Textbox value from query (A2K)

    I've solved my problem by using the dlookup function but I need help with another problem. On the same form, there are 22 comboboxes which each display a list of F1 drivers. These boxes record the position of each driver in a particular race. Is there a way that I can select a driver for the box labelled 1st (winner) who would then not appear in the remainder of the boxes. Similarly, when choosing the driver for the box labelled 2nd, neither 1st driver nor second driver would appear in boxes 3rd to 22nd etc..?

    Or is there a more efficient solution?

    Cheers

    Rob
    <font color=blue><font face="Script MT Bold"><big>Rob</big></font face=script></font color=blue>

  3. #3
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: Textbox value from query (A2K)

    Hi Rob,
    Do you have all 22 drivers defined in the one table? If you have, well, I wouldn't have done it that way.
    I would have separate records for each driver per race and a field on that table telling me the finishing order of the driver.
    You could do this quite nicely with a subform and you could just fill in the finishing position of each driver (this would be the only field to be entered, so it would be rather fast data entry).

    I had to do something similar once with dog trials where I had a main form (venue and who judged) and 2 subforms (first one showing which events were being run at the venue, the second which dogs had entered with a field for the finishing position), so this ended up being a main form, a subform and a sub subform. It worked quite well.

    Pat <img src=/S/cheers.gif border=0 alt=cheers width=30 height=16>

  4. #4
    4 Star Lounger
    Join Date
    Sep 2002
    Location
    Stafford, Staffordshire, England
    Posts
    585
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Textbox value from query (A2K)

    Hi Pat, just like the Lone Ranger coming to the rescue yet again.
    Thanks for the advise. I take it you mean that in the Results table there would be something like:
    ResultID(Primary key); RaceID; DriverID; PositionID as foreign keys?
    I'm starting to get there but problems like in my newest post are time-consuming and frustrating.

    Best wishes

    Rob
    <font color=blue><font face="Script MT Bold"><big>Rob</big></font face=script></font color=blue>

  5. #5
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: Textbox value from query (A2K)

    That's the idea, although what does this Results table refer back to? Is there a table showing the date and venue of the race?

    So what you could have is the table which shows the race and venue as the main form and the results table as a subform. The only field to be filled in on the subform would be the PositionID (or is that simply FinishingPosition).

    Pat <img src=/S/smile.gif border=0 alt=smile width=15 height=15>

  6. #6
    4 Star Lounger
    Join Date
    Sep 2002
    Location
    Stafford, Staffordshire, England
    Posts
    585
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Textbox value from query (A2K)

    <img src=/S/clapping.gif border=0 alt=clapping width=19 height=23> <img src=/S/aussie.gif border=0 alt=aussie width=21 height=22>
    <font color=blue><font face="Script MT Bold"><big>Rob</big></font face=script></font color=blue>

Posting Permissions

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