• Textbox value from query (A2K)

    Author
    Topic
    #381681

    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

    Viewing 0 reply threads
    Author
    Replies
    • #644469

      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

      • #644519

        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 cheers

        • #644521

          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

          • #644525

            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 smile

    Viewing 0 reply threads
    Reply To: Textbox value from query (A2K)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: