NewTexican
Technical User
what is the best way to assign a variable a value in one subroutine and then use that variable in another. I have a subroutine that adds a record to a table depending on a checkboxs' values.
Sub exarecordsetaddnew()
Dim rs As DAO.Recordset
Dim db As Database
Set db = CurrentDb
Set rs = db.OpenRecordset("Company-Mailout T")
With rs
.AddNew
![Company Numeric] = Me!Text18
![Address Type] = Me!Text20
!Mailout = "c mailout " & [highlight] mlout[/highlight]
![Send mailout] = [highlight] mloutyn [/highlight]
.Update
End With
rs.Close
End Sub
the highlighted variables depend on the checkbox being checked (I was thinking it would be best to reuse this procedure for each textbox on the form)
Sub exarecordsetaddnew()
Dim rs As DAO.Recordset
Dim db As Database
Set db = CurrentDb
Set rs = db.OpenRecordset("Company-Mailout T")
With rs
.AddNew
![Company Numeric] = Me!Text18
![Address Type] = Me!Text20
!Mailout = "c mailout " & [highlight] mlout[/highlight]
![Send mailout] = [highlight] mloutyn [/highlight]
.Update
End With
rs.Close
End Sub
the highlighted variables depend on the checkbox being checked (I was thinking it would be best to reuse this procedure for each textbox on the form)