passing a value & adding a new record

sonia
10-26-2004, 06:14 AM
hi all hope all is well

i am using access 2000 .
I have two forms, form1 and form2. form1 has a command button which opens up form2 and shows to values of two textboxes which are on form1 in form2 in separte textboxes.

I would like to add a new record and then after the values of form1 are added to form2...

my code which i am using is below



Public bkTranInid As String ' public variable doing an instantiation of the form2 in from1


Dim bktranIN As Form_frmbookTranIn
Set bktranIN = New Form_frmbookTranIn

Dim str As String
str = "SELECT stock.id, stock.bookname, bookTranIn.bookreceivedid" & _
"FROM stock INNER JOIN bookTranIn ON stock.id = bookTranIn.bookreceivedid "

Dim rs As Recordset
Set rs = Recordset()

Dim db As Database
Set db = CurrentDb()

DoCmd.OpenForm "frmbooktranin", acNormal

bktranIN.bookreceivedid = rs.Fields("id").Value
bktranIN.txtbkname = rs.Fields("bookname").Value

Shurik12
10-26-2004, 09:21 AM
Hi,

>I would like to add a new record and then after the values of form1 are added to form2...

Just do the following:


db.Execute ("Insert Into...")

sonia
10-26-2004, 01:17 PM
hi thanks for t reply

take care ;) sonia

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum