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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Use Command Button to Post to Seperate Table 2

Status
Not open for further replies.

TravTrav

IS-IT--Management
Jun 4, 2002
115
0
0
US
Another question for the access gods of this forum:

I have a form that users put server maintenance items into that require approval. Once their items are approved and completed, I would like to have a command button they use confirming completion that posts the items field and the server name field to a seperate table. Anyone know how I could do this?

Thanks,
Travis
 
Take a look at Append query.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
PHV,
Not sure what you mean, please elaborate....
 
Syntax of an append query:
INSERT INTO table (field list) VALUES (value list)
Or:
INSERT INTO table (field list) SELECT instruction

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
This might be a litte longer a solution then some of the others, but you don't need to create a query. If you place this code in the OnClick event of your command button you will get the same result.


Dim cnn As ADODB.Connection
Dim rs As ADODB.Recordset

Set cnn = CurrentProject.Connection
Set rs = New ADODB.Recordset

strsql = "SELECT * FROM TableNameYouWantToStoreItIn"

With rs
Set .ActiveConnection = cnn
.CursorType = adOpenDynamic
.LockType = adLockOptimistic
.Open strsql

.AddNew
![FieldName1InTable] = Me.TextBoxName1OnForm
![FieldName2InTable] = Me.TextBoxName2OnForm
.Update

End With
rs.Close
cnn.Close

Hope This Helps

Cheers

Destiny Is Not The Chances We Take, But The Descisions We Make.
 
Matethreat,
Thank you so much, that worked perfectly! Star to you....

Travis
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top