I have a field that requires a user to put a date into. my dates are in the format 20040203 now i wantt to make sure the user enters a date greater then 2004?
i was doing this > 2004 in the validate property with a message box saying enter a date greater then 2004 but giving me an error when their is 20050203 the message box pops up? what am i missing or how should i handle this?
I have a field that contains an input mask : 99/99/00 99:00;0;_ this allows the user to enter a date and time in one field. Such as 04/24/13 15:00 . I want to put validation on that field, so that the user can't enter a time that does not exist such as "25:30" or a date that hasn't happened yet. How to accomplish that? The data is going into a linked SQL table so I'm limited on what I can do on the table end I think.
I am trying to write a more complex macro that will start another macro at a preset time, however I am getting stopped at the first hurdle - getting a macro to run another macro.
Here is the code i am using at the moment, all I want to do currently is click the first button, then get the second macro to execute. But no luck, getting error 2157 "cannot find the procedure"
I have two tables in my Access database, their fields are exactly the same (for now). One table is called Uncheched. The other one is called Checked. So what is need is a macro that takes selected records in table Unchecked and copies them to the end of table Checked. Actually CUTS from Unchecked and PASTES to the end of Checked table.
Sub MoveRecords() DoCmd.RunCommand acCmdCut DoCmd.OpenTable "tblChecked", acNormal, acEdit DoCmd.GoToRecord , , acLast DoCmd.RunCommand acCmdPaste End Sub
I think this is probably a simple solution for some of you.
I have a database containing records for which I need to set dates to follow up on.
I would like to ensure that the date that is entered is a business day (So that when I run my follow up report for the day - I don't end up missing items that were inadvertantly entered for a weekend!)
I have hunted around for a similar thread - but have not found anything.
I am thinking that a simple bit of validation could be entered for the field properties.
I am trying to validate that the user selects at least one checkbox out of three on the form in Access 2010. They can select one, two or even all three if they wish, but at least one must be checked. I am using the following code attached to the click event of a command button. It was fine but seems to have stopped working. The control names are generic to illustrate my code. The form is unbound:
if (chk1 + chk2 + chk3) = 0 then Msgbox "Please select at least one checkbox" exit sub end if
I have a textbox where I need an afterupdate event, which should check that input is 3 letters followed by 3 numbers. The total is 6 characters, but always 3 letters + 3 numbers. If condition not met, a msgbox will be shown, for the user to input correctly, before being able to continue.
I have a table called 'Klanten' which contains the rows 'password' and 'login' (and several rows not needed for this form)
So I'm trying to make a login form which first checks if something is entered (this part of the code seems to work).
Private Sub Knop13_Click() 'Check to see if data is entered into Username If IsNull(Me.Username) Or Me.Username = "" Then MsgBox "gelieve een login in te voeren.", vbOKOnly, "Required Data" Me.Username.SetFocus
[Code] ....
But from then on i seem to have some issues.. The part of the code underneath seems to only work for the first 'login' and 'paswoord' in my table called "Klanten".
-Username is the name for the field where they enter their 'login'. -Password is the name for the field where they enter their 'paswoord'
If Username.Value <> DLookup("[login]", "Klanten", "[Username]='" & Username & "'") Then MsgBox "Invalid Username. Please try again.", vbOKOnly, "Invalid Entry!" Exit Sub End If
If Password.Value <> DLookup("[wachtwoord]", "Klanten", "[Password]='" & Password & "'") Then MsgBox "Invalid Password. Please try again.", vbOKOnly, "Invalid Entry!" Exit Sub End If
Then as last part i would like to goto another form called 'Mainmenu' if both the Login and the Paswoord is correctly entered in the fields Username and Password. Here i have the most issues as this doesn't seem to do anything at the moment
If Password.Value = DLookup("[wachtwoord]", "Klanten", "[Username]='" & Username & "'") And Username.Value <> DLookup("[login]", "Klanten", "[Password]='" & Password & "'") Then DoCmd.OpenForm "Mainmenu" End Sub
I am trying to write following code, I want Msg to pop, when all three condition are true, but it not working
'''Non Budgeted Projects need Explanation and Variance class"
If Me.ID.Value >= 90000 And and Me.Variance_Class = "" and Me.Comments_Explanation_Delta_____100K = "" Then
MsgBox "This project is Unbudgeted. Please Add 'Variance Class' and provide Explanation why this project is Unbudgeted project has been added.", vbExclamation, "Rules Checker..." CheckRules = False GoTo Exit_CheckRules
I'm new to access vba and I'm trying to create a login form. I have already my code to login but i want to validate the password in 'case sensitive' basis. Below is only what I've got so far.
Code: Private Sub cmdLogin_Click() Dim login_validation As Variant login_validation = DLookup("Password", "tblLogin", "Username='" & Nz(txtUsername.Value, "") & "'") If Nz(login_validation, "") <> Nz([txtPassword].Value, "") Then MsgBox "Incorrect Password. Please try again." txtUsername.Value = "" txtPassword.Value = "" txtUsername.SetFocus Else MsgBox "Hi " & txtUsername.Value & "," & vbNewLine & vbNewLine & "you have successfully login!" DoCmd.OpenForm "frmMain" End If End Sub
I am having an issue using DCount to validate against 3 fields within my database. I have a booking form which contains a Staff member, viewing slot, and Viewing Date which is used to book property viewings.
I want the form to check that the booking doesn't already exist when the process booking button is pressed.
I am using the following statement:
Code: If DCount("*", "Viewing", "[Staff_ID]=" & Me.[Staff_ID] & " AND [Viewing_Period] = " & Me.Viewing_Period & "' AND Viewing_Date = '" & Me.Viewing_Date) & "'" > 0 Then MsgBox "Cannot book, booking already exists", vbCritical End If
I always get the error "Syntax Error (Missing Operator)".
I am trying to deny users from logging on from multiple pc's. Here is how i've got it so far,created table tblLoginLock with fields EmpID and LoggedIn both numberical data type created a form to set the Empid with tempvar!TempEmpId and LoggedIn as 1 when a user logs in.When he clicks the logOff button he is signed out and a form opens up and closes to set the LoggedIn field to 0.Now whenever a user is signed the LoggedIn Field is checked with this expression
if there is a one then the user is logged in the condtion is met and a message box pops up to warn the user that he is already logged in.
The above code does not check the specific TempVar to the LoggedIn field, the LoggedIn field is randomly checked for a '1' meaning if there is a '1' anywhere in the table then the condition is met and the user denied. how can i set the condition to validate the logged in user to the LoggedIn field.
Access 2007 / I'm creating a database form that has a combo box drop down pulling EmployeeName and a free text field to enter a password. I need the password entry validated against the password stored in a column on the same row as the Employee Name selected from the combo box when a button is clicked. . IF, that value is validated, I need the button click to also record a "time in" or "clock in" entry in a different table.how to validate the password.
I have a continuous subform that displays lots of questions. This specific form has 10 questions on it. Each question has one answer and the users are required to select one answer for each question. I am trying to do some data validation before the data gets saved to my table to ensure that users have answered all the questions. I found some very useful code online and tweaked it to suit my needs. The validation works perfectly on subforms with only one question, as I have some other tabs that use it.
On the specific form that has the issue, the validation works as expected when no question has been answered, but when a user answers only one question and leaves the remaining nine questions blank, the validation does not work. I guess it is as a result of the continuous form repeating the different questions and ms access thinking that the data entered for one question alone is complete when it actually isn't.
Code: Private Sub Ctl4_frm_Staff_Exit(Cancel As Integer) Dim ctrl As Control, EmptyStr$ For Each ctrl In Form_subFrm_staffQuestion.Controls If InStr(1, ctrl.Tag, "Required") > 0 Then If IsNull(ctrl.Value) Or ctrl.Value = vbNullString Or Len(ctrl.Value) = 0 Then
I have a form with Date of Death (DOD) field. I would like update DOD from a table dbo_patient into Z_Patients table.
I have set the datatype as Date/Time in the form for Date of Death.
Code: Private Sub Update_DOD() Dim rcMain As New ADODB.Recordset, rcLocalDOD As New ADODB.Recordset Dim DOD As String rcMain.Open "select distinct PatientKey from Z_Patients", CurrentProject.Connection
[Code] ....
However I am getting some error Run-time error '-2147217913 Date type mismatch in criteria expression in section below.
Code: CurrentProject.Connection.Execute "update Z_MAIN_Processed_Patients set DateOfDeath = '" & rcLocalDOD!date_of_death & "' where PatientKey = " & !PatientKey
Can I look up and verify data on a "second" form based on a selected record from first (still open) form.
I am trying to allow users to select a User Name from a combo box list and then open "Change Password" form when they select "Change Password" for that selected user name.
My problem is that I can't figure out how to associate and verify the data tied to the user name selected on the previous (Login) form ( I am trying to validate the old password tied to that selected record).
I have the first login form created, and it's working just fine. I also have the change password form created (and it's displaying the user name selected from the first form using:
Code: Private Sub Form_Load() With Forms![frmLogin]![cboUserName] Me.txtPwdChgUserID = .Column(2, .ListIndex) End With EndSub
I also have the code written to validate and confirm old password, new password and validate new password (when the save button is clicked). I have yet to update the password with the new password (still trying to figure that out).
Attached zip file has screen shots of the two forms.
how to get macro properties using vba? I've attempted something similar to the below to try and divine macro properties:
Code: Sub MacroDiscovery() Dim mcr As AccessObject Dim prop As AccessObjectProperty For Each mcr In CurrentProject.AllMacros Debug.Print mcr.Name For Each prop In mcr.Properties Debug.Print prop.Name Debug.Print prop.Value Next Next End Sub
Nothing comes up except the macro names. In my database, I have an AutoExec macro that I have manually added a description to; "This macro auto-executes when the database is opened by virtue of it's name." I can view the description by right-clicking on the macro and choosing 'Object Properties'.
Background:I am attempting to make a universal Access Database documenter for the many, many homemade databases on our network. I'm only interested in certain pieces of information and I would like to make a report to view the information how I want to view it. Thus, I don't care for the built-in documenter--I want to do it my way.
I have inserted a function via a module at the beginning of a Macro using the RunCode action:
Function Msgbox_Yes_No() Dim Response As Integer Response = MsgBox(prompt:="Select 'Yes' or 'No'.", Buttons:=vbYesNo) If Response <> vbYes Then End If End Function
However, it doesnt stop the macro from continuing on its way to delete a load of records if the user chooses no.
I have 2 forms and a macro in Form1 which runs throught every record to update the records, however.I would like to run this macro from the main form (Form2)
I'm working in 2003 (still) and have a macro to print the selected form the user has on their screen. I need this same macro to also print a PDF in a particular network folder or just exit if the PDF doesn't exist. I've tried RunSQL with "PrintDoc [Link2PDF]" as the argument. I've tried RunApp with "Acro Rd32.exe /t [Link2PDF]" as the argument but neither one works. The RunApp line will open the Adobe reader but nothing more.
I would like to have a macro run at a set time each day. I hoped to use .ontime but apparently that doesn't exist in access.
The macro must run at 10:00am each day, the db will be open from 8:30am until 16:30pm so no problem from that point of view +/- a few mins when the staff arrive.