Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Default, Populated Fields

Status
Not open for further replies.

NewfieSarah

Programmer
Feb 7, 2005
147
CA
Hey All, I have a main form PID and and Building form I need to have the data from the building table display on the building form, upon adding a new record. Since my PID form and building form are linked to show the same records. PID Form contains- PIN NUM, ADDRESS, PARID. The Building form contains, PIN NUM, DATE, PHONE, OWNER, SIZE, LOCATION... I open my main form filter my results for my reocrds to show up... PIN-20053227, ADDRESS-MAINSTREET, PARID-NEWFIE22. This data is obtained through the PARID table. Now I click on the command button to see my building forms, there are 6 records, here I have the ability to add, modify, delete, save... What i want to do is add a new record, but have some generic fields appear from my table. since my name, PIN, address hasnt changed. So I would like to click add, and have appear from the building table, OWNER, PHONE etc... How might I be able to do this?? Thanks
 
Why not use tabbed forms? From (at least) Access 2000 creating tabbed forms is as easy as dragging from the toolbar. Use the top portion of the page for your static data (address etc) and the tabs for your changing data.

If you reduce the size of the form design so you can see your forms list you can simply click-drag existing forms into the tab as a starter ~ yes, you have to link them (as with any sub-form) but it is a quick start.
Regards
Paul
 
HUMM I am not sure If i really want to change all my forms, since they are in the format that I like them in and I dont have the time really! So I was hoping that there would be a way to display my data from the table to the form. Thanks
 
Nope cant use the default value. Would like to take it from the table.
 
could you make a query of the info you want and use dlookup to pull it into the table?
 
i suppose I could. use a query but why would I use a dlookup to pull it into the table. I dont want to pull data into the table I would like to pull out of the table... Oh my why is this problem such an issue!! I thought that it might be so easy to pull information and display it on my form.
 
i'm sorry, i didn't mean the table, i meant to say into the form
 
oh okay, then Well I guess I could make one, I am not sure that is what I want to do though. What type of code, would I use for that. the idea of display the data from the table to the form is when i add a new record the user wouldnt have to enter there own information again, since it is already in the table.
 
actually, you could pull the data straight from the table with dlookup. what you need is just
dlookup("field name", "tblname", criteria)
that would pull that value into the form.
 
okay so i need the owner name in the table that is related the the pin number would you say? since, I tryed the dlookup with just field name and tblname and I got the first owner in the table not the owner related to the record i was on. so I could probably use something like, where pin is = to form_pid.address3.value what would the code be for that n the criteria position??
 
if pin is the field in the table, then i think it should be like
"[Pin] = " & forms!form_pid.address3
 
that is not working. I put what you suggested and i got you have cancelled your previous action. should that even be the code for the criteria??
 
so for the control sourse do you have
=dlookup("fieldname","tblname",criteria)

you are just trying to put some values into a textbox on a form, correct? do these values then need to be stored, if so, maybe the dlookup should be in the default value of the control.

if neither of those work, hopefully someone else will jump in and set us both straight.
 
yeah that is what I have. yes I am trying to put some values into a textbox on a form. they do need to be stored in the table after it is saved yes. That would be nice for someone to jump in for more opinions! So here is what I have again:
Dim NAME As String
NAME = DLookup("OWNER", "BUILDING")
OWNER.Text = NAME

Now When I used this I got the first records owner not the owner that I am currently working on. So I was thinking that is should probably have a criteria?? correct?? Well I am not sure what criteria to put there. Maybe relate it to the pin number on the main form?? So "[PIN] = " & Form_PID.ADDRESS3.Value
PIN being in my building table and the pin on the main form address3.value... However I didnt work either. Nothing happened! So What do you think now??
 
you don't need the code, just open the properties for the control, like name, and put the dlookup directly in there.
 
Okay I did that and it didnt work... well it worked but it gave me to first owner in my table not the owner whos record I was working on!
 
did you have the criteria in the dlookup?
take at look at the dlookup bit in the access help, maybe it will help you get the criteria better than i could.
 
yes I had the criteria in the lookup and i think I need something better then what I have. Since it is not working, I did look at the access help and nothing is standing out that can help. Thank again
 
Hi Sarah
I have had a look at you problem, but find i hard to head or tails of. But this is what I have:
1. you have a main form and a few "sub"-forms, but not as tabbed forms.
2. you want to add a new record into a form.

Is the new record on the main form or is it on one of the "sub"-forms.

Are these sub-forms sitting on the main form, and if so how are they linked (child and master fields).


Herman
Say no to macros
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top