Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Save autofilled form into table

Status
Not open for further replies.

mikacp

Technical User
Aug 27, 2003
2
US
I have a form with an combobox (cboID), autofilled textboxes (txtsubmittedby, txtextension, txttype) filled by "=cboID.column(1), =cboID.column(2), etc.", and empty textboxes (txtassignedto, txtassignedextension, txtassigneddate) to type info into. I have the form based on a query with all of these fields in it (all from External table except "assigned" fields from Assigned table). The combobox is linked to an autonumber field.

1. How do I have all the information save into a table (the autofilled fields and the assigned fields) with each record?
(there should be a different autofill with each number in the combobox)

2. Go to a new record while saving the current record (i.e. a commandbutton)

I have Access 97.
I appreciate any help.
 
Mike,

I'm not sure this will help but I had a similar problem and solved it with the following Tek Tip.


I will include the code I used on my form as it is slightly different when you can look at the code as a whole. This was attached to the "OnClick" property of a button I Labeled "Save" (Command14)

Private Sub Command14_Click()
On Error GoTo Err_Command14_Click

Dim rst As Recordset
Set rst = CurrentDb.OpenRecordset("Sched_table")
rst.AddNew
rst!Adj_Log = Me.Total_log
rst!OpCode = Me.OpCode
rst!Date = Me.Date
rst!Adj_Sched = Me.Sched_total
rst!Adherence = Me.Adherence
rst!Supervisor = Me.Supervisor
rst!RIATime = Me.RIA_Time
rst!PTTTime = Me.PTT_Time
rst.Update
rst.Close
Set rst = Nothing

Exit_Command14_Click:
Exit Sub

Err_Command14_Click:
MsgBox Err.Description
Resume Exit_Command14_Click

End Sub

Command 14 being the name of the "Save" button and "Sched_Table" being the name of the Table I wanted to save to. The rst!**** includes the name of the field in the new Table (instead of ****) and Me.**** is the name of the field on the form you are saving from (also instead of ****). I do not have my form set to move to a new record when it is saved as I have calculations on this form that are dependent on Values on another form.

It is also important to note that the Record Source for the form itself must be set to the new table you are saving to (This caused me no end of problems in the beginning).

Forgive me if this sounds Dumbed Down, But I don't know your experience level and tried to explain it in easiest possible terms. Hope this helps.

Jim
 
Also:

I forgot that I had this answered in Great fashion by Frank Hill. See this post for the BEST info:

thread702-541115
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top