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!

unbound txt boxes

Status
Not open for further replies.

anthony777

Programmer
Nov 8, 2008
24
US
I have five unbound text boxes
custid
starttime
finishtime
worksheet
invoice
one unbound txtbox box is called elaspedtime which is the time from start to finish that calculates
I need when I click the finish button
need the custid, starttime,finishtime,worksheet or invoice depending which task it is and elasped time to update the table1 I created with the fields.

Please help
 
thanks because the custid could be a new one. Maybe I am missing something could all the fields be bound and still allow new data entry because the table would start off fresh no data
 
user enters the custid
they then chose whether its a worksheet or invoice
by putting y in either of the txt boxes one for worksheet one for invoice when they are finished they click stop the timer on the form stops then they click finish and the timer populates the finished time in the finished time box and in the middle is a txt that says elasped time

I just need to get the information once they click finish into the database table so we can see how much time it is taking on average for each task without the user having to cut and paste alot.

Thank You
 
I am not sure what you are attempting to do. By "update the table1" it suggests updating a record. I would expect you actually want to insert a records.

You might be able to create and execute a sql statement like:
Code:
Dim strSQL as String
strSQL = "INSERT INTO table1 (fld1, fld2, fld3,...) " & _
   "Values(" & Me.txt1 & "," & Me.txt2 & "," & Me.txt3 & "...)"
DoCmd.RunSQL stsrSQL
This all depends on the fields and their data types. This code will also prompt for permission to run unless you set warnings off. Remember to set them back on when you are done.

Duane
Hook'D on Access
MS Access MVP
 
thanks I am still having one problem the syntax to update the table here is my code

Option Compare Database
Option Explicit

Dim TotalElapsedMilliSec As Long
Dim StartTickCount As Long
Dim strsQL As String

Private Declare Function GetTickCount Lib "kernel32" () As Long


Private Sub btnStartStop_Click()
If Me.TimerInterval = 0 Then
StartTickCount = GetTickCount()
Me.TimerInterval = 15
Me!btnStartStop.Caption = "Stop"
Me!btnReset.Enabled = False
Else
TotalElapsedMilliSec = TotalElapsedMilliSec + (GetTickCount() - StartTickCount)
Me.TimerInterval = 0
Me!btnStartStop.Caption = "Start"
Me!btnReset.Enabled = True
End If
End Sub

Private Sub Command5_Click()
Dim dtmStart As Date
Dim dtmEnd As Date
Dim intTimeDiffSecs As Integer
Dim strsQL As String

dtmStart = [txt_Start] '"14/09/09 10:55:23" & ("hhmmss")
dtmEnd = [ElapsedTime] '"14/09/09 10:57:11" & ("hhmmss")













'intTimeDiffSecs = DateDiff("m", dtmStart, dtmEnd)

'MsgBox intTimeDiffSecs
Me.txtfinishtime = (dtmStart + dtmEnd)

End Sub

Private Sub Form_Timer()
Dim Hours As String
Dim Minutes As String
Dim Seconds As String
Dim MilliSec As String
Dim Msg As String
Dim ElapsedMilliSec As Long

ElapsedMilliSec = (GetTickCount() - StartTickCount) + TotalElapsedMilliSec

Hours = Format((ElapsedMilliSec \ 3600000), "00")
Minutes = Format((ElapsedMilliSec \ 60000) Mod 60, "00")
Seconds = Format((ElapsedMilliSec \ 1000) Mod 60, "00")
'MilliSec = Format((ElapsedMilliSec Mod 1000) \ 10, "00")

Me!ElapsedTime = Hours & ":" & Minutes & ":" & Seconds '& ":" & MilliSec

End Sub

Private Sub btnReset_Click()
TotalElapsedMilliSec = 0
Me!ElapsedTime = "00:00:00" ':00"
Me!txt_Finish = "00:00:00"
End Sub

Private Sub txt_Finish_Click()
strsQL = "Insert into timer(custid,starttime,finishtime,worksheet,invoice,elaspedtime) " & _
"Values( " & me.CustID & "," & me.Starttime & "," & me.txtfinishtime & "," & me.txtworksheet & "," & me.txtinvoice & "," & me.txtelaspedtime)"
&_)"


End Sub
keeps saying syntax error

thank you for all your guidance and help in this matter
 
Without looking at all the code and knowing which line is causing the syntax error, your final line seems wonky:
Code:
Private Sub txt_Finish_Click()
strsQL = "Insert into timer(custid,starttime,finishtime,worksheet,invoice,elaspedtime) " & _
"Values( " & me.CustID & "," &  me.Starttime & "," & me.txtfinishtime & "," &  me.txtworksheet & "," &  me.txtinvoice & "," & me.txtelaspedtime)"
[red][b]&_)"[/b][/red]

End Sub


Duane
Hook'D on Access
MS Access MVP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top