More help needed with linking two forms 
Author Message
 More help needed with linking two forms

Hi, I'm almost there, but...

I am trying to link two forms - The main form  has an ID field and the
requirement has a ReqID field.  I have a Button on main form for see
requirements.  When the user clicks on the "See Requirements Button", I
want the Requirements form to appear, and the user should be able to scroll
through the different requirements one at a time using the DBNavigator
Button.

I have the following code:

procedure TRequirements.FormCreate(Sender: TObject);

var
  i, code : integer;

begin
  Val(MyBadges.EditID.Text, I, Code);
  Query1.ParamByName('BadgeID').AsInteger := I;
  Query1.Open;
end;

When I click on the See Requirements button, it lets me browse through the
requirements database, however I can only see the requirements for badge
#1.  Even if I go to badge 2 or higher, it only brings up requirements with
ReqID = 1.  Can someone give me a hand..... is this being placed in the
wrong area or something???

Thanks in advance....  

Kevin Coleman
--

Kevin Coleman
http://www.*-*-*.com/



Wed, 10 Feb 1999 03:00:00 GMT  
 More help needed with linking two forms

Hi Mark, thanks for your info - I tried the strtoint instead of Val and I
got the same result.

I have one paramater named badgeid and it is of data type integer.  There
is no value and the null value box is not checked.

My SQL code says:

Select
  jrbadreq."ReqID",
  jrbadreq."ReqNumber",
  jrbadreq."Requirement",
  jrbadreq."ReqDate"
From "c:\delphi\jrbadreq.db"
Where reqid = :badgeid

It still for some reason is still selecting all records with the reqid of 1
even if it should be 2 or 3.  I stepped through the execution of the
program and it seems like it's choosing the number at compile time instead
of when the button is pressed.  Maybe the params code shouldn't be in the
TRequirements.FormCreate area?!?!?

Thanks for your help.... Kevin
--

Kevin Coleman
http://members.aol.com/kevinc1081



Thu, 11 Feb 1999 03:00:00 GMT  
 More help needed with linking two forms

Quote:

> Hi, I'm almost there, but...

> I am trying to link two forms - The main form  has an ID field and the
> requirement has a ReqID field.  I have a Button on main form for see
> requirements.  When the user clicks on the "See Requirements Button", I
> want the Requirements form to appear, and the user should be able to scroll
> through the different requirements one at a time using the DBNavigator
> Button.

> I have the following code:

> procedure TRequirements.FormCreate(Sender: TObject);

> var
>   i, code : integer;

> begin
>   Val(MyBadges.EditID.Text, I, Code);
>   Query1.ParamByName('BadgeID').AsInteger := I;
>   Query1.Open;
> end;

> When I click on the See Requirements button, it lets me browse through the
> requirements database, however I can only see the requirements for badge
> #1.  Even if I go to badge 2 or higher, it only brings up requirements with
> ReqID = 1.  Can someone give me a hand..... is this being placed in the
> wrong area or something???

Have you checked that the text in the edit box is being converted
correctly?  Why not try StrToInt?  If this is not the problem, it may be
with your SQL...can we have some more info?

--
Mark.



Fri, 12 Feb 1999 03:00:00 GMT  
 More help needed with linking two forms

Thanks for the help (rec'd through email). Actually, I managed to get it to
work this morning from a hint.  In the OnCreate event on the requirement
form, it had FormCreate.  I got rid of that and changed the OnActive to
FormCreate and the OnClose to FormClose (closed the table).  That worked!!!
Thanks for everything!!!  (I'm getting there) Kevin
--

Kevin Coleman
http://members.aol.com/kevinc1081



Fri, 12 Feb 1999 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Need help linking form to OLE Data Fields

2. Two D array help needed.

3. Multi Table (more than two) form

4. Search using two forms

5. Re : passing values between two forms

6. How to pass two dates to a query tbl into a quick report form

7. Q : Two forms using same subform!?

8. Two forms editing

9. The same table in two forms in D1

10. How to link two tables?

11. Link two tables with TQuery

12. Need Help: Unloading Forms/Databases from Memory

 

 
Powered by phpBB® Forum Software