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

Update Table from Form - Record 1

Status
Not open for further replies.

Xenophobia

Technical User
Apr 7, 2003
18
US
Hello,

My question shouldn't be too complicated, except I am just uncertain as to how to get this done without the built in Access navigation buttons at the bottom of forms.

I have an access application with the database in this same application, so no external linking is going on here.

I have a form called "mainApp" and what is going on here is that "mainApp" is getting user information through the first form, "login". The "login" form passes a global variable into the "mainApp" form where the unique user who logged in can now access respective information that is stored for them in tables. They then choose 3 different items from a combo box, pick a date, and enter how many hours they spent with this particular entry (the application is a time study).

What I need is to be able to create a type of 'submit' button that when a user clicks this 'submit' button, all the fields in the "mainApp" form are saved to a table (containing: uniqueId, empNumber, the three combo box fields, date, and hours)

Thank you in advance for any help,

~ Xenophobia
 
Also, The code I tried putting behind this button was:

"

Private Sub update_Click()

Dim strSQL As String

strSQL = "INSERT INTO timeRecord (empNumber, accountCode, costCode, fundCode, date, hours)"
strSQL = strSQL & "VALUES(" & Me.txtEmpId & "," & Me.cboGrants & "," & Me.cboCostCenters & "," & Me.cboFundSource & ", #" & Me.calendar & "#, " & Me.cboHours & ");"
Execute strSQL

Me.cboGrants = Null
Me.cboCostCenters = Null
Me.cboFundSource = Null
Me.cboHours = Null

End Sub

"

Although the error I get is when it tried to run "Execute strSQL"... For some reason today I am drawing a blank on what is required to execute user defined functions...

P.S. - I'm using Access '03
 
You meant the following ?
CurrentDb.Execute strSQL

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top