This topic is locked

Service DataBase using Master-Detail

3/25/2008 7:53:03 PM
ASPRunnerPro General questions
M
matt.cohen author

Hi,
I currently have a database set up that tracks service jobs. It's pretty simple at the moment but I would like to add spare parts and their usage to it. I am guessing I'll need a master-detail relationship in the database. I have setup two new tables in the database one with the spare parts and one that has the spare part usage.
Two things

I am not sure how to link the tables.

I would like to know if once I am finished will operators be able to enter in services into the database and on the same form enter in spare parts used. At this point it seem I need to forms which makes it a little odd to use.
Thanks in Advance
Mathew

Sergey Kornilov admin 3/25/2008

Each form allows you to enter data into a single table which means you need two forms to enter the main record and spare parts. I recommend you to use AfterAdd event to redirect user to spare parts add page.
I recommend you to watch "How to setup master-details relationships" tutorial at http://xlinesoft.com/asprunnerpro/tutorial.htm.

M
matt.cohen author 3/26/2008

Each form allows you to enter data into a single table which means you need two forms to enter the main record and spare parts. I recommend you to use AfterAdd event to redirect user to spare parts add page.

I recommend you to watch "How to setup master-details relationships" tutorial at http://xlinesoft.com/asprunnerpro/tutorial.htm.


Sergey,
Thank you for your advice. I have now got it working.

I have another question. Would it be possible to view the spare parts used on a service when look at the service record in the view page.

I imagine it would mean editing the page in the visual editor and inserting some asp code. Can you point me to a forum topic that may help.
Thanks in advance

J
Jane 3/26/2008

Hi,
you can do it using ViewOnLoad event on the Events tab.

Actual event code is dependent on your tables structure.

M
matt.cohen author 3/27/2008

Hi,

you can do it using ViewOnLoad event on the Events tab.

Actual event code is dependent on your tables structure.


I have read the section on events and understand them but Im not sure how they help me change what is displayed on the view page.
What i need is to display the records from another table at the bottom of the view page where a particular field equals the primary key of the record being displayed.
I hope this makes sense. I imagine that someone has done this before I just cant find a reference in the forums.
Thanks

J
Jane 3/27/2008

Matt,
here is a sample code:

if Request("editid1") then

str = "select * from AnotherTable where RecordID=" & Request("editid1")
Set rsTemp = server.CreateObject("ADODB.Recordset")

rsTemp.open str, dbConnection
while not rsTemp.eof

Response.write "FieldName : " & rsTemp("FieldName") & " | "

Response.write "FieldName2 : " & rsTemp("FieldName2") & " | "

Response.write "FieldName3 : " & rsTemp("FieldName3") & " | "

Response.write "
"

rsTemp.MoveNext

wend
rsTemp.Close : set rsTemp = Nothing
end if

M
matt.cohen author 3/27/2008

Matt,

here is a sample code:


Many thanks Jane