I have a job-tracking system, and there is a query that returns results of all jobs that are overdue. I have a form that displays each of these jobs one-by-one, and has two buttons (Job has been completed, and Job not completed). Not completed simply shows the next record. I cannot find a way to get access to the current record to update it s contents if the "Has been Completed" button is pressed, the closest I can get is the long number which represents the records position in the form.
The VBA to get the index of the record in the form is as follows.
Sub Jobcompleted(frm As Form)
Dim curr_rec_num As Long
curr_rec_num = frm.CurrentRecord
End Sub
This is my first shot at VBA, and after an hour of searching I cannot find anything to solve my problem. Am I going about this the entirely wrong way? Working in Microsoft Access 2007
<<>Further
车辆表
就业情况表: 工作岗位——id(pk)、汽车(id)(fk)和其他信息,说明需要做什么,以及下一个工作日期、工作间隔(所有工作重复)和其他信息
工作史表: 工作岗位——理论学(pk)、工作(id(fk)、完成日期和评论
When the job completed button is pressed, it should create a new entry in the job history table with the current date, any comments and the job id
This is the script I am trying to get working
Private Sub Command29_Click()
Dim strSQL1 As String
Dim strSQL2 As String
Set Rs = CurrentRs
Set db = CurrentDb
strSQL1 = "INSERT INTO completed_jobs(JOB_ID, DATE_COMPLETED, COMMENTS) VALUES " & Rs!job.ID & ", " & Date
db.Execute strSQL1, dbFailOnError
strSQL2 = "UPDATE job SET JOB_NEXT_OCCURANCE = JOB_NEXT_OCCURANCE+JOB_RECURRANCE_RATE WHERE job.ID = Rs!job.ID"
db.Execute strSQL2, dbFailOnError
End Sub
注:线路<代码>Set Rs = CurrentRs完全不正确,我认为这是我需要说明的。 这一点呼吁纽芬兰语
我的图像显示形式(非连续性)。
@HansUp,我得到你所说的话,但我原想完全认为它适用(我没有首次为你们提供足够信息,以理解我的想法)。
@sarh 我认为,你所谈论的是,我需要的是什么,但我无法说明如何使用它,以及任何方面?
@Matt,我有90%相信我正在使用约束性表格(我说,新到来的是,我一直在研究人们所建议的一切,并学习我。) 当然,有一份工作证明(没有显示,没有必要看到),但我如何利用这个身份开展行动? 我可以这样做,与进出/签证局融合在一起。