Updating a form's detail records

thepatrik

New member
Local time
Today, 16:50
Joined
Feb 20, 2007
Messages
6
Hi! I'm a bit of a noob when it comes to this so, be aware. There are two forms. One (form A) that is containing a list box of all the occurrences from a specific table in the database. The other one (form B) also contains information about the same occurrences but in greater detail. In this form you can browse through the records by using the record footer.

When you click on a row in the list box (form A), you reach the other form (form B). I have managed to pass the argument from a given row in form A to form B, but i don't have a clue of how to manipulate the form's "detail records" with the id passed on from form A.

Any help is appreciated!

Patrik
 
Couple of clarification questions:
1. How are you passing the argument?
2. What kind of data source is formB? Is it directly bound to the table?
3. How familiar are you with VBA, because it will almost certainly be required?
 
1. I pass the arguments using DoCmd.OpenForm and catch them with ID = CInt(Me.OpenArgs) in the other form.
2. Yes, the form seems to be directly bound to this table.
3. I have done some things in VB 6 in the passed, but I'm in no way new to programming.
 
What I would do then is to instantiate a recordset object in formB and set it equal to the forms recordsetclone collection. Use Find method with the new recordset object to attempt to locate the record. If the Find returns nothing you can throw an error message, but if the Find does locate something, it will set the position of the Recordset to the correct position of the record. You obtain this position through the AbsolutePosition property for the recordset. So you then set the forms AbsolutePosition to equal the recordset's Absolute Position and the correct record will be displayed. Let me know if you want clarification/code for any of the steps.
 
Thank you for your reply. Some questions:

How do I reach the form's recordset? Can I use something like Me.Recordset
Do I need to dim the recordset variable as and ADODB.Recordset?

Would you be kind enough to show me a code example?

Thanks again...
 
I solved it by manipulating the recordset directly: Me.RecordSource = SqlStr

Thanx a bunch!
 

Users who are viewing this thread

Back
Top Bottom