469,658 Members | 1,862 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,658 developers. It's quick & easy.

Form / subform

I am trying to develop a mileage log for a set of company vehicles. I have created two tables in my testing and set the relationships. I want to have a subform on my mileage log showing the car and a photo of the car.

I have created a test frmMileage form with the subform from the tblCarInfo. I can not get the subform out of datasheet view. I have gone to the properties of the main form and selected single form with no success.

Any thoughts?

Nov 20 '08 #1
5 1410
3,532 Expert 2GB
To change the view of the subform, you need to open the form it is based on, in Design View, and change it there in the Properties Sheet.

But I have to say that it sounds as if you've got the horse before the cart here! A form/subform is usually a One to Many relationship. The normal way of doing this would be to have the car's identification info, photo, etc on the main form (the One side) with the mileage being shown in the subform (the Many side.)

Linq ;0)>
Nov 20 '08 #2
OK good advise. I found this out when I started with the test form. It is now working like I want the relationship to be working.

I still can not get the subform to reconize anything but datasheet.

Thanks for the help.
Nov 20 '08 #3
OK that worked. Thanks so much. The form is looking good. The next question is this; I want to have the code prefill the starting mileage in the mileage subform from the ending mileage of the previous input. I have tried a query and with no luck.

Nov 21 '08 #4
Ok it is late and I finally have had a chance to get back to this small project.

I have created two tables tblMileage and tblCarInfo. The corresponding field in each table is called CarNumber. I have created the key on tblCarInfo field CarNumber. I have then created relationship between the two tables one two many between the car number from the mileage to the car info.

I created a test form and it placed the table info from both tblCarInfo and tblMileage on the form. I entered the first car it allows me edit the mileage for that car on that form in the datasheet Subform. I want to enter a new car and when I get ready to enter the mileage I get an error stating "The changes you requested to the table were not successful because they would create duplicate values in the index, primary key or relations ship. Change the data in the fields that contain duplicate data, remove the index, or redefine the index to receives duplicate entries." Like I said I know its late but I can not figure this out.

Also when I switch from car to car I would like the other fields to prefill on the form. Still have not figured that out.

Nov 28 '08 #5
It was late and I had the key on the wrong table.

The child table shows up on the form but in datasheet. Is there a way to change that to single form?
Nov 28 '08 #6

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

9 posts views Thread by William Wisnieski | last post: by
2 posts views Thread by Claude | last post: by
9 posts views Thread by PC Datasheet | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.