originalrobby
asked on
About the recordsource property
Hi,
I have several tables, and several forms (with one main form), each form has its own table. All of those forms/tables keep information about a single project so I need to be able to display the same project when a user goes from one form to another. I am trying to control the recordsource property of each form to display the record id that is coming from the main form. I've tried everything from putting the id on the main form(which is auto generated) in a variable so that I can then use an SQL statement in my other forms to bring the id that matches the main form.
Anyways to keep it short, when I do
SELECT * FROM SECTIONV.RecordID WHERE = 'recToGo';
it always says error 2001 "You cancelled the previous operation".
I just cannot seem to get it to select the record that I want it to based on what the variable recGoTo contains.
If I take out the single quotes it will ask me for the parameter value of recToGo then it will go to the right record.
Any help would be greatly appricated because this is driving me nuts!
Thank You
Robert Mezei
Programmer
rmezei@hotmail.com
I have several tables, and several forms (with one main form), each form has its own table. All of those forms/tables keep information about a single project so I need to be able to display the same project when a user goes from one form to another. I am trying to control the recordsource property of each form to display the record id that is coming from the main form. I've tried everything from putting the id on the main form(which is auto generated) in a variable so that I can then use an SQL statement in my other forms to bring the id that matches the main form.
Anyways to keep it short, when I do
SELECT * FROM SECTIONV.RecordID WHERE = 'recToGo';
it always says error 2001 "You cancelled the previous operation".
I just cannot seem to get it to select the record that I want it to based on what the variable recGoTo contains.
If I take out the single quotes it will ask me for the parameter value of recToGo then it will go to the right record.
Any help would be greatly appricated because this is driving me nuts!
Thank You
Robert Mezei
Programmer
rmezei@hotmail.com
recToGo is a control in the "main" form, right?
recToGo is a control in the "main" form, right?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
sometimes you say recGoTo and sometimes you say recToGo; is it as simple as maybe you are spelling it wrong? ;)
So when you take out the quotes, it asks for the parameter, but if you type in the correct RecordID, you get the correct results right? If so, might the variable contain the wrong data? Also, if there is only 1 record on the main form, you could have all the secondary forms reference the original form via the query builder. If you put criteria in your query builder of the secondary forms, something like:
Forms!frmMainForm!txtRecor dID
Then it should use the recordID from the main form as the criteria for the secondary form (main form must remain open).
Forms!frmMainForm!txtRecor
Then it should use the recordID from the main form as the criteria for the secondary form (main form must remain open).
ASKER
Dudes, you're all so damn good!
I just graduated recently and don't have much experience.
Although I already figured it out, I am accepting this answer man, because it's close! Thanks alot guys, this is what i got:
sqlString = "SELECT * FROM [SectionV] WHERE [RecordID]=" & Forms!frmSales!frmSecOpsRe cID & ";"
Form_frmSecOps.RecordSourc e = sqlString
same thing I guess, either way it works! lol
I just graduated recently and don't have much experience.
Although I already figured it out, I am accepting this answer man, because it's close! Thanks alot guys, this is what i got:
sqlString = "SELECT * FROM [SectionV] WHERE [RecordID]=" & Forms!frmSales!frmSecOpsRe
Form_frmSecOps.RecordSourc
same thing I guess, either way it works! lol
ASKER
Form_frmSecOps.RecordSourc
Form_frmSecOps.RecordSourc