Results 1 to 13 of 13

Thread: Record source

  1. #1
    Join Date
    Oct 2003
    Location
    Finland
    Posts
    80

    Unanswered: Record source

    I have form that I need for entering data in several tables. What I need is a pop-up form, which has one combo box for selecting the right table. I have created the form, but I don't know how to continue.

    1. How can I make the combo box look for the tables as it values, so that the user can choose the right table? I have 4 tables now, but there will be more in the future.

    2. What kind of code do I need for the combo box to change record source for the form?

  2. #2
    Join Date
    Oct 2003
    Location
    Finland
    Posts
    80
    I'll try to make this a little bit easier to understand:

    When I open the form that is used to enter data, it should open the pop-up form that asks, which table is the record source. User can choose table from a combo box, which has looked for tables when the form is opened.

    This is a very important part of the database, if you have any suggestions how to do it or you know a better way to do it, please reply.

  3. #3
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1

    Re: Record source

    Originally posted by Sham81
    I have form that I need for entering data in several tables. What I need is a pop-up form, which has one combo box for selecting the right table. I have created the form, but I don't know how to continue.

    1. How can I make the combo box look for the tables as it values, so that the user can choose the right table? I have 4 tables now, but there will be more in the future.

    2. What kind of code do I need for the combo box to change record source for the form?
    Copy and Past the next code in the RecordSource of your ComboBox

    SELECT MSysObjects.Name, MSysObjects.Flags, MSysObjects.Type
    FROM MSysObjects
    WHERE (((MSysObjects.Flags)<>-2147483648 And (MSysObjects.Flags)<>2 And (MSysObjects.Flags)<>-2147483645) AND ((MSysObjects.Type) In (1,4)))
    ORDER BY MSysObjects.Name;




    Then you will be able to select only tables form your DB.
    Good luck

  4. #4
    Join Date
    Oct 2003
    Location
    Finland
    Posts
    80
    Thank you for suggestion, but it doesn't work... when I open the form all the fields are filled with "#Name?".

  5. #5
    Join Date
    Oct 2003
    Location
    Finland
    Posts
    80
    I found this in google's comp.databases.forum.ms-access -forum:

    "The fact that you get the right number of records means that you've
    successfully changed the record source for your form, but #Name#
    showing up in each of your fields means you haven't dealt with
    changing each individual field's rowsource. (You have to point it to
    the new fieldname...)
    If you do not use the same field names for your tables, then you must
    change the controlsource of each of the fields in your form in the
    same code you use to set the recordsource for the form."

    I got 5 records, but I only have 4 tables...

  6. #6
    Join Date
    Oct 2003
    Location
    Roanoke, Va
    Posts
    445

    Smile

    Originally posted by Sham81
    I found this in google's comp.databases.forum.ms-access -forum:

    "The fact that you get the right number of records means that you've
    successfully changed the record source for your form, but #Name#
    showing up in each of your fields means you haven't dealt with
    changing each individual field's rowsource. (You have to point it to
    the new fieldname...)
    If you do not use the same field names for your tables, then you must
    change the controlsource of each of the fields in your form in the
    same code you use to set the recordsource for the form."

    I got 5 records, but I only have 4 tables...
    Do each of the tables contain the same fields?

    If there are different fields in each, you might try hiding/showing controls depending on which source table you are using.

    Gregg

  7. #7
    Join Date
    Oct 2003
    Location
    Finland
    Posts
    80
    All the tables contain same fields, with same fieldnames and everything... just the table names and the records are different.

  8. #8
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1
    Originally posted by Sham81
    Thank you for suggestion, but it doesn't work... when I open the form all the fields are filled with "#Name?".
    Then try this:
    Copy and past that in a new QUERY and try it:

    SELECT MSysObjects.Name, MSysObjects.Flags, MSysObjects.Type
    FROM MSysObjects
    WHERE (((MSysObjects.Flags)<>-2147483648 And (MSysObjects.Flags)<>2 And (MSysObjects.Flags)<>-2147483645) AND ((MSysObjects.Type) In (1)))
    ORDER BY MSysObjects.Name;

    It functions by me an shows the tabels' names

  9. #9
    Join Date
    Oct 2003
    Location
    Finland
    Posts
    80
    It works now, it gives me all the tables, but it also has this in it "MSysAccessStorage". That's why it gave 5 records instead of 4. How can I get rid of this extra record?

  10. #10
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1

    Question

    Originally posted by Sham81
    It works now, it gives me all the tables, but it also has this in it "MSysAccessStorage". That's why it gave 5 records instead of 4. How can I get rid of this extra record?
    What is this MSysAccessStorage? Does it shine under the TableName? and what Flag does it have? also 0 and Type = 1?

  11. #11
    Join Date
    Oct 2003
    Location
    Finland
    Posts
    80
    I don't know what it is, I don't have that kind of table. It has 10 flags and type is 1.

  12. #12
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1

    Lightbulb

    Originally posted by Sham81
    I don't know what it is, I don't have that kind of table. It has 10 flags and type is 1.
    And now try this

    SELECT MSysObjects.Name, MSysObjects.Flags, MSysObjects.Type
    FROM MSysObjects
    WHERE (((MSysObjects.Flags)<>-2147483648 And (MSysObjects.Flags)<>2 And (MSysObjects.Flags)<>-2147483645 And (MSysObjects.Flags)<>10) AND ((MSysObjects.Type) In (1)))
    ORDER BY MSysObjects.Name;

    Have nice day

  13. #13
    Join Date
    Oct 2003
    Location
    Finland
    Posts
    80
    Thanks... it's working now

Posting Permissions

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