Dim MyTime As Date, DataTime As Date

MyTime = Format(Now, "hh:mm:ss")
DataTime = 'Get the time from your database here

If MyTime > DataTime Then
   ' Code to Open Door
      Else
   Code To Close Door
End IF

im having a hard time with SQL, please help with the codes of SQL

and vb, here is the situation, i have a input using textbox "the input is a bar code,

ive just assumed that the code is input in a textbox so even i dont have a bar code

reader ill be able to do it" after ive input a digit in the textbox, example 13420100001

the system will locate if there is a matched of the digit in the database, ive already

done that but here is my problem, after the system located that the digit that is been

inputted in the textbox has the same digit in the database "of course the digit is

registered in a student", the system now will compare the time in and time out of the

student, also the days he/she can enter the room,

for example the student input his/her student number in the system, now the student is registered in the database, the timein is 2:00:00PM, timeout is 3:00:00PM then the days he has class in the room is monday and wednesday only, he inputted this student digit at exactly 2:00:00PM, monday it means he can go in the room, a message box will send the message that he/she can enter the room

Dim WithEvents pol As Timer

Private Sub cmdInput_Click()
Dim myTime As Date, DataTime As Date

myTime = Format(Now, "hh:mm:ss")
DataTime = ""

End Sub

Private Sub cmdNew_Click()
frmInsert.Show
End Sub

Private Sub Form_Load()
Form1.BorderStyle = fixedsingle


    Set pol = Form1.Controls.Add("vb.timer", "pol", Form1)
    With pol: .Interval = 200: .Enabled = True: End With


Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\studentdatabase.mdb;Persist Security Info=False"
Adodc1.RecordSource = "Select * from Login"
Set DataGrid1.DataSource = Adodc1
Adodc1.Refresh

End Sub
Private Sub Pol_Timer()
    txtTime.Text = Format$(Time, "hh:mm:ss AM/PM")
    txtDate.Text = Format$(Now, " mmmm dd, yyyy")
    txtDay.Text = Format$(Now, "dddd")
End Sub



Private Sub txtInput_Change()
Adodc1.RecordSource = "select * from Login where StudId like '" + txtInput.Text + "'"
Adodc1.Refresh
End Sub

the code above can only determine if a student inserted a valid/ registered student digits

Recommended Answers

All 4 Replies

another info, if the student inputted his number at 2:15:00PM or 2:43:00PM he can enter the room, any time between 2:00 - 3:00PM because it is his/her schedule

Have a look at your post with the select statement there.

Please close/mark as solved this thread. I will be concentrating on your newest post.:)

ive already marked as solved my first thread, this is a new thread

I do apologise, my mistake.:)

The first is still not marked as solved though. Please do so thanks,:) THIS is the link to your first post. The "Solve This Thread" is at the bottom of the page.

To your problem.....

You will be using something like -

myRS.Open "SELECT MyDateField FROM MyTableName WHERE DateValue(" & "'" TextDate.Text & "')", con, adOpenStatic, adLockOptimistic
 
If myRS.EOF = True Or myRS.BOF = True Then
Exit sub
Else
DataTime = myRS!MyDateField

You can also do this without the "DateValue()" part.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.