Pass a variable from a text box(s) to another textbox

H

hansjhamm

I am new to the Access game and run across issues that I just do not
have a clue how to do...

On my form I have a Combo Box where the user selects a store number and
all the pertinent information in the textboxes fill in...this is for
viewing purposes only. I have 4 text boxes where the user will input
information for new data storage. This is running very smoothly. My
problem is this; I need to input into another table the store number
from the combo box along with the date selected and # of resumes sent
out. The date and resumes I can do, I just DO NOT know how to pass the
store number from one table thru the combo box into another table on
the fly...


Help is needed on this one!


Hans
 
J

Jim Moore

This is not an expert answer, but this is how I did it. Code is posted
below.
Private Sub UpdateAction_Click()
On Error GoTo Err_UpdateAction_Click
' DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
Dim msg As String
Dim numCitations, numCitationLevel As Integer
Dim lngNumberOfEntries As Long
Dim StudentIndexID As String
Dim dbs As Database
Dim rcdStudent, rcdAction As Recordset
Dim table, name, schTarget As String
'Get total number of entries in behavior table
' Set dbs = CurrentDb
Set dbs = CodeDb
' table = "StudentASQ"
Set rcdStudent = dbs.OpenRecordset("StudentASQ", dbOpenDynaset)
StudentIndexID = [Forms]![CitationAction]![StudentID]
schTarget = "[StudentID] = " & "'" & StudentIndexID & "'"
With rcdStudent
.MoveLast
.FindFirst schTarget
name = rcdStudent.Fields("LastName").Value
numCitationLevel = [Forms]![CitationAction]![NewLevel]
.Edit
rcdStudent.Fields("CitationLevelProcessed").Value =
[Forms]![CitationAction]![NewLevel]
rcdStudent.Fields("ActionRequired").Value = False
.Update
End With
rcdStudent.Close

Set dbs = CodeDb
' table = "StudentASQ"
Set rcdAction = dbs.OpenRecordset("ActionRecord", dbOpenDynaset)
StudentIndexID = [Forms]![CitationAction]![StudentID]
schTarget = "[ID] = " & "'1'"
With rcdAction
' .MoveLast
.AddNew
!StudentID = [Forms]![CitationAction]![StudentID]
!ActionLevel = [Forms]![CitationAction]![NewLevel]
!Submitter = [Forms]![CitationAction]![Submitter]
!Date = Now
.Update
End With
rcdAction.Close
Exit_UpdateAction_Click:
Exit Sub

Err_UpdateAction_Click:
MsgBox Err.Description
Resume Exit_UpdateAction_Click

End Sub

Note that I have shown two ways to update the data tables. Hope this helps.
Jim Moore
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top