what properties to set for row source and control source?

merlin777

Well-known Member
Joined
Aug 29, 2009
Messages
1,397
Office Version
  1. 2007
I'm putting a query into a subform on a form. The query filters records from my main table (which also has records on the form) and shows a list of records. The filter parameters are entered in controls on the form above the subform. One is a date and the other a name.

The date is ok - I used a text box, set the format to date and it automatically shows the date picker.

The name is giving me some problems. I'm using a combobox and want to point it at a list of names in tblnames, the name field is lastname. My main table is called tblappointments and contains a numeric field called nameid which is linked to the ID field in tblnames.

The name selection is a free choice from the list and independent of any of the records being displayed on the main form.

I'm not quite sure what to set the properties to, including control source and row source. I thought I would need record source but it's not offered in properties.

Should the combobox be bound or unbound and if so how and why?

I'm getting across a lot of the complexities of access but I must admit I'm finding this bit the trickiest so far...
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
Normally this kind of thing works best if the fields are part of the main form record source. Otherwise the fields (date and or name, in your case) don't "do" anything. Then you can use them to set up the parent-child relationship between the main form and subform.
 
Upvote 0
so, would it be possible to create a field in the main table which is the firstname+lastname from the names table? Then I use that as a source for the combo box and my filter query.

That also has the advantage of using both first and last names to filter on which is something I was going to do anyway. Choosing a date with a text box and date picker and passing to my query for filtering seems to work ok already.
 
Upvote 0
Well, ideally subform and main form are related in some way (ID to ID, for instance). Then they will naturally "synchronize" so to speak.
 
Upvote 0
How would I do that? Is it just a case of going to the relationship screen and making a one to one or one to many relationship with the id fields?
 
Upvote 0
Well, I hesitate to say anything too lightly. Yes, it might be that simple. But it is up to you to decide (or find out) how the tables are related. It's not good just dragging relationship arrows between tables if the data isn't going to fit into that structure. But a good database will indeed have table relationships defined, at least conceptually if not explicitly. I'm not clear about your data in this case. Are the tables actually related?
 
Upvote 0

Forum statistics

Threads
1,223,578
Messages
6,173,167
Members
452,504
Latest member
frankkeith2233

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top