• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 319
  • Last Modified:

Manipulating recordsets in code

I need to create and open two recordsets in VBA code.

One recordset will be read-only and used to create/update records in the other recordset.

I know how to do  the manipulations but forget how to declare and open recordsets in VBA code.  I would also like to see the code for updating and adding a record in a recordset.

mlmcc
0
mlmcc
Asked:
mlmcc
  • 5
  • 2
1 Solution
 
Rey Obrero (Capricorn1)Commented:

dim rs1 as dao.recordset,rs2 as dao.recordset

set rs1=currentdb.openrecordset("table1")

set rs2=currentdb.openrecordset("table2")
0
 
mlmccAuthor Commented:
What if I wanted to limit the records with a filter on the product code  I can write the SQL but what changes in the opening of the recordset?

mlmcc
0
 
mlmccAuthor Commented:
For instance something like

Select productcode, weight from table1 where productcode = 1234\

mlmcc
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
Rey Obrero (Capricorn1)Commented:

dim rs1 as dao.recordset,rs2 as dao.recordset
dim sql as string

sql="select * from Table1 where <criteria >"
set rs1=currentdb.openrecordset(sql)

set rs2=currentdb.openrecordset("table2")
0
 
mlmccAuthor Commented:
Thanks.  I will try that tonight and let you know how it works out.

mlmcc
0
 
mlmccAuthor Commented:
Worked perfectly.

mlmcc
0
 
mlmccAuthor Commented:
Thanks.  
0

Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

  • 5
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now