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 John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Writing Input to alternate table...Please help!

Status
Not open for further replies.

mvpdep

Programmer
Nov 11, 2005
21
CA
Good morning here is my dilema. I have an open form called 'frm log' that is bound to table 'tbl account'. On 'frm log' I have the following data showing:

tbl accountid
tbl biz name
tbl phone

As well I have an unbound button called 'make call'. When I click the button I open a new form in a new window called 'frm calls'. It is bound to table 'tbl calls' it has the following data showing:

tbl callid
tbl accountid
tbl call type
tbl call outcome

When this second form opens I want the field tbl accountid to be filled with the account id in the first form 'frm log'. I would like all of this information to be written in as a new record to 'tbl calls'.

so for example on 'frm log' I have

tbl account id = 1234
tbl biz name = hello inc
tbl phone = 9999999999

when I open the second form 'frm calls' I would like to see

tbl callid (autofills)
tbl accountid = 1234 (from previous form)
tbl call type (user selects type of call)
tbl call outcome (user selects outcome)

And then the user would click save and a record would be stored into 'tbl calls' with '1234' as the accountid.

I need this because I will be running reports from 'tbl calls' to monitor how many calls are made to specific accounts, types of calls etc.

Any help you could give me would be greatly appreciated thanks.

 
Why not have 'frm calls' as a linked subform ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
That would be a great idea however my difficulty is getting the account id in the subform and in the calls table so I can run appropriate reporting.

I hope there are more suggestions out there please???
 
Provided the relationships are properly set, the subform wizard will automagically link the forms with account id.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
phv thx for you help am i to assume that I am setting up a 1-many relationship from the account table to the call table?

tx
 
in the second form ( the calls ) in design view open the properties for the accountid. Set the Default Value to the value of accountid on the frm log form. Use the wizard (...) to help.

It should probably say =Forms![frm log]![AccountID]

This should ensure that the relationships are built

Regards

BuilderSpec
 
I now have it working thank you all...however it currently has each entry top to bottom and the next new one at the bottom.

How can I set up the form so that the new entry is always at the top of the form vs. the bottom. I know this will have something to do with sorting on the 'tbl time of call' field but I'm not sure how to do it. Any help would be appreciated thanks.
 
You can sort the table as you say so that it is in reverse time order so the latest is at the top... however i am not familiar with a quick way to make the new entry field be at the top.

You could try putting unbound controls in the form header and an Add button. then you would have to validate , add the record and refresh manually through code.

Regards

BuilderSpec
 

Create a query to sort the table 'tbl calls' the way you like. Bound the form 'frm calls' to that query. It will always be sorted the way you need
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top