在时间表db中使用sql insert into语句访问VB [英] Using sql insert into statement with access VB in a timesheet db

查看:92
本文介绍了在时间表db中使用sql insert into语句访问VB的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在ms访问中创建一个时钟输出(时间表)中的简单时钟。我有两个表(工作人员姓名为tblnames,计时时间为tbldates)。 tblnames有2个字段,即id = autonumber,names = text。和tbldates有4个fiels Id = autonumber,namesid = number,clockin =时间/日期和时钟输出=日期/时间。


这两个人有一对多的关系


我的表单有一个包含员工姓名的组合框。以相同的形式我有一个名为clock in的cmd按钮。另一个称为时钟输出

功能:

用户从组合框中选择名称,当用户点击cmd clockin按钮时,当前日期应该是插入到tbldates表中的clockin字段中,并且应该禁用cmd clockin按钮并启用cmd clock out按钮。


当用户单击clockout按钮时,当前日期应该是插入tbldates表中的clockout字段。这将成为tbldates表中的单个记录,第二天clockin和clock out日期/时间应该放在tbldates表的第二个记录中。


我虽然放了一个sql 插入并且d up up使用VB的语句,以便当用户点击按钮中的时钟时,如果在表tblnmes中存在名称(在组合框中选择)并使用插入语句来插入相应的(相关的),则使用dlook up to cheeck )tbldates表中各自字段中的date -clockin和clock out值。

这些表有一对多的关系所以我可以在时钟输出时插入时钟到tbldates table为正确的相应的员工。

我不知道如何在vb或任何有想法但很难实现它...


我怎么能实现这个。


附件是我想要的表格和一些解释的截图....



I am trying to create a simple clock in clock out (timesheet) in ms access. I have two tables (tblnames for staff names and tbldates for clocking times). tblnames has 2 fields namely id=autonumber,names =text. and tbldates has 4 fiels Id=autonumber,namesid=number, clockin=time/date and clock out =date/time.

the twos have a one to many relationship

I have a form that has a combo box that holds names of employees. in the same form i have a cmd button called "clock in" and another called "clock out"
Function:
The user selects the names from the combo box and when the the user clicks on the cmd clockin button the current date should be inserted into clockin field in the tbldates tables and and the cmd clockin button should be disable and the cmd clock out button should be enable.

When the user click clockout button the current date should be inserted into clockout field in the tbldates table. This becomes a single record in the tbldates tables and the next day the clockin and clock out dates/times should go in the second record of the tbldates tables.

I though of putting a sql "insert into" and "d look up" statement using VB so that when the user clicks on the clock in button the visual basic as to use the dlook up to cheeck if names (selected in the combo box) exist in table tblnmes and use to insert into statement to insert the corresponding (related) date -clockin and clock out values in its respective fields in the tbldates table.

The tables have one to many relationship so I could I go about inserting clock in clock out times into the tbldates table for the correct coresponding employeee .
I dont how to this in vb or whatever got the idea but hard to implemnt it..

How could I acheive this.

Attached is a screenshot of my desired form and some explaination....

附加图像
qst.jpg (20.4 KB,513 views)
Attached Images
qst.jpg (20.4 KB, 513 views)

推荐答案

这是一个位于网络上的数据库,每个人都使用相同的数据库吗?它位于一台PC上吗?会有多个用户吗?


我想我很清楚你想要什么,但为了更好地指导你,我需要一些关于你打算如何使用这个数据库的信息对于什么。
Is this a database located on a network, where everyone uses the same database? Is it located on a single PC? Will there be multiple users?

I think I have a good idea of what you want, but to better guide you, I would need some information on how you would intend to use this database and for what.


这就是我做的...


对于时钟按钮:
Here''s what I did...

For the clock in button:

展开 | 选择 | Wrap | 行号


@TheSmileyOne


谢谢。这个数据库将在完成后放在网络上,但目前我正在笔记本电脑上工作,肯定会有多个用户。


我是一名研究生实习生试图创建一个非政府组织中的雇员的timeshhet数据库。这个数据库将由员工用于进出时间,并且还计划放置cmd按钮以显示/运行报告,此时comco框中的名称是老板的名字。


感谢您抽出宝贵时间和善意帮助..
@TheSmileyOne

Thanks. this databse will be put on a network after completion but at the moment am working on it on a laptop and definetly there will be multiple users.

I am a graduate Trainee trying to create a timeshhet database for emplyees in a NGO. This databse will be used by the employees to clock in and out and am also planing to put a cmd button to display/run report only such time the name in the comco box is the boss''s name.

Thanks for for time and good heart to help..


这篇关于在时间表db中使用sql insert into语句访问VB的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆