queries with mulitple records (1 Viewer)

Bladerunner

Registered User.
Local time
Today, 03:58
Joined
Feb 11, 2013
Messages
1,799
i know not what I need to ask for so bare with me. I have a tblhealthrecord that has many multiple entries for the same animalID. Would like to pull up all records from this tbl for one animal. I can sort them later but just need to know what to ask for so I can read upon them. I at first thought this could be based on date but not really since you could have multiple entries in one day.

Anyone got any directions to point me in.


Blade
 

jdraw

Super Moderator
Staff member
Local time
Today, 06:58
Joined
Jan 23, 2006
Messages
15,386
Try this (untested)

SELECT * FROM YourTableNameHere
Where animalID = [Enter The AnimalID]
 

Bladerunner

Registered User.
Local time
Today, 03:58
Joined
Feb 11, 2013
Messages
1,799
thanks a bunch

Blade
 

Bladerunner

Registered User.
Local time
Today, 03:58
Joined
Feb 11, 2013
Messages
1,799
I do have another question? when you populate a form via a query, Form recordset=query? do you have to use all text boxes or remove the row source from the controls in the frm?
 

jdraw

Super Moderator
Staff member
Local time
Today, 06:58
Joined
Jan 23, 2006
Messages
15,386
Form has a recordSource, usually the table or a query that supplies data to the form.
Some controls combo/listbox have RowSource which is different that Form's Recordsource.
Rosource usually a query with the values you want in the control, or a ValueList if you input the values you want for theCombo/list box.
 

Galaxiom

Super Moderator
Staff member
Local time
Today, 20:58
Joined
Jan 20, 2009
Messages
12,853
Be careful not to confuse the Recordset with the RecordSource. The RecordSource Property is a string with the name of the table or query (or SQL query string) that provides the data to the form.

The Recordset Property is the object that actually holds the records.

Not allowed: Recordset = "myquery"

Allowed: Me.RecordSource = "myquery"

Allowed: Set Me.Recordset = MyRecordsetObjectVariable

There is no need to remove the fields from the RecordSource query or Recordset just because they are not displayed in controls on the form.

BTW You can still refer to the fields in the recordset via VBA. This can be useful when you want to be able to modify the data put into the control before it is sent to the table.

When you enter Me.somename the default is to the Controls Collection of the form. If a control by that name is not found, Access with look in the Fields collection of the form's recordset.

If you want to refer to the field when there is also a control with the same name use:
Me.Recordset.fieldname

When the control is bound to the field, the returned value will be the same either way.
 

Bladerunner

Registered User.
Local time
Today, 03:58
Joined
Feb 11, 2013
Messages
1,799
allright!...a lot of good stuff here. Now, its up to me to put it together and make it work.

Thank you.


Blade.
 

Users who are viewing this thread

Top Bottom