Possible To Validate A Single Record In A Field
Aug 19, 2014I've done some looking into how to validate in Access and I found how to do it for an entire field but I was wondering if it's possible to validate a single record in a field.
View RepliesI've done some looking into how to validate in Access and I found how to do it for an entire field but I was wondering if it's possible to validate a single record in a field.
View RepliesI have a tblCustomer table to track customer information. One field is for flights the customer books. I expect that a customer might book more than one flight, which should affect what he owes. (My tblFlights table includes fields for the cost of each flight.) How should I make the Flight field in tblCustomer so it accepts multiple flights and reflects on the customer's final bill and my own accounting tables that I haven't even created, yet?
I'm probably overthinking everything. This is just an Intro to Access class, and I only need 3 tables with 1 relationship. So far, I have 9 primary tables, 4 duplicate tables (for M:N relationships) and 11 relationships. I have to have tables for financial data, customer info and product/service info. I wasn't sure what I would need for my fictional airline, so I created tables to track everything I could think of, hoping to cover all 3 required types of data in the process.
Any Single line of code available?
View 2 Replies View RelatedI am trying to create a form with a button attached to each record that would allow the user to click the button and it would automatically open outlook and fill in the TO:, SUBJECT: and BODY: fields. Here is the code that I currently have:
Code:
Private Sub Command33_Click()
Dim strEmail As String
Dim strMsg As String
Dim oLook As Object
Dim oMail As Object
Set oLook = CreateObject("Outlook.Application")
Set oMail = oLook.CreateItem(0)
[code]...
There are two issues I keep running into:
1. This code opens outlook and populates all of the fields but pastes the email incorrectly. Instead of pasting just the email (email@email.com) it pastes the html tags as well (email@email.com#mailto:email@email.com#) which means that the user would have to delete everything between the #'s in order to send the email every time.
2. I currently have the email BODY pulling from a table but this obviously limits what I can do. I would like to simply encode the BODY within the VBA code. The setup I am looking for is:
one paragraph
a blank line
a hyperlink to a website
a blank line
another paragraph
How to get this one to display in a single column.
I know how to do this wiht VBA. But, this output will need to reside on a SQL Server View. So I need a SQL language solution. If it can work in MS Access Query, it won't be too difficult to test then translate to SQL Server.
Customer Table with PK Customer_ID.
There are two tables with FK Customer_ID.
1. Table Lease1 - Has 3 Fields - the form code enforces No Fields -or All Fields. The red * indicate a Required field - These 3 are entered together.
2. Table Lease2 - Has 1 field with 0 to Many records.
Goal:
The Type shows up in a single column.
Each Type shows where the data comes from (Lease Type, Surface Owner, Mineral Owner, or Hz Lease Type)
Challenge:
Lease1 table has 3 fields that need to be transformed into a single column.
Lease2 table has 1 field to be appended to the single table.
Then, there is the column that identifies where the data came from based on the column name.
Hi
I was wondering if anybody could help with this. I have searched through this forum and there doesnt seem to be an answer to this.
I have a form that i would like to validate. At present i have put the data validation on the save button which triggers a script that checks to see if certain boxes have been filled in on the form. I can only get this to work be attaching it to the onclick event on a save button, however, what i really want is to be able to ditch the save button (since access writes to the DB as it goes along) and have this script triggered whenever the user tries to navigate to either a new record/ another existing record or close the form
I tried putting this on the beforer update event, but this does not work, additionally tried doing before update event with the code inside an if me.form.dirty = true statement
this did not work either, has anybody got any suggestions
Please see my code below
Thanks
Marcus
Dim sDeliveryto As String
Dim sDeliveryValid As String
Dim sDept As String
Dim sDeptValid As String
Dim sReq As String
Dim sReqValid As String
Dim sReqNo As String
Dim sReqNoValid As String
Dim sReqPoint As String
Dim sReqPointValid As String
Dim sOrderDetailsValid As String
Dim sQuantity1 As String
Dim sQuantity1Valid As String
Dim sDetails1 As String
Dim sDetails1Valid As String
Dim sPrice1 As String
Dim sPrice1Valid As String
Dim sSupplier1 As String
Dim sSupplier1Valid As String
Dim sCostCentre1 As String
Dim sCostCentre1Valid As String
Dim sAccountCode1 As String
Dim sAccountCode1Valid As String
Dim sAuth As String
Dim sAuthValid As String
sDeliveryto = Me.TBDeliveredTo & ""
sDept = Me.TBDept & ""
sReq = Me.tbrequisitioner & ""
sReqNo = Me.TBRequisitionNo & ""
sReqPoint = Me.TBReqPoint & ""
sQuantity1 = Me.TBQ1 & ""
sDetails1 = Me.TBD1 & ""
sPrice1 = Me.tbup1 & ""
sSupplier1 = Me.tbs1 & ""
sCostCentre1 = Me.ccc1 & ""
sAccountCode1 = Me.tbac1 & ""
sAuth = Me.TBAUTH & ""
Select Case sDeliveryto
Case Is = ""
Me.TBDeliveredTo.BackColor = "8421631"
sDeliveryValid = "Invalid"
Cancel = True
Case Else
sDeliveryValid = "valid"
Me.TBDeliveredTo.BackColor = "16777215"
End Select
Select Case sDept
Case Is = ""
Me.TBDept.BackColor = "8421631"
sDeptValid = "Invalid"
Cancel = True
Case Else
sDeptValid = "valid"
Me.TBDept.BackColor = "16777215"
End Select
Select Case sReq
Case Is = ""
Me.tbrequisitioner.BackColor = "8421631"
sReqValid = "Invalid"
Cancel = True
Case Else
sReqValid = "valid"
Me.tbrequisitioner.BackColor = "16777215"
End Select
Select Case sReqNo
Case Is = ""
Me.TBRequisitionNo.BackColor = "8421631"
sReqNoValid = "Invalid"
Cancel = True
Case Else
sReqNoValid = "valid"
Me.TBRequisitionNo.BackColor = "16777215"
End Select
Select Case sReqPoint
Case Is = ""
Me.TBReqPoint.BackColor = "8421631"
sReqPointValid = "Invalid"
Cancel = True
Case Else
sReqPointValid = "valid"
Me.TBReqPoint.BackColor = "16777215"
End Select
If Len(sReqPoint) < 6 Then
sReqPointValid = "Invalid"
Me.TBReqPoint.BackColor = "8421631"
Cancel = True
Me.lblReqPoint.Visible = True
Else
sReqPointValid = "valid"
Me.TBReqPoint.BackColor = "16777215"
Me.lblReqPoint.Visible = False
End If
Select Case sQuantity1
Case Is = ""
Me.TBQ1.BackColor = "8421631"
sQuantity1Valid = "Invalid"
Cancel = True
Case Else
sQuantity1Valid = "valid"
Me.TBQ1.BackColor = "16777215"
End Select
Select Case sDetails1
Case Is = ""
Me.TBD1.BackColor = "8421631"
sDetails1Valid = "Invalid"
Cancel = True
Case Else
sDetails1Valid = "valid"
Me.TBD1.BackColor = "16777215"
End Select
Select Case sPrice1
Case Is = ""
Me.tbup1.BackColor = "8421631"
sPrice1Valid = "Invalid"
Cancel = True
Case Else
sPrice1Valid = "valid"
Me.tbup1.BackColor = "16777215"
End Select
Select Case sSupplier1
Case Is = ""
Me.tbs1.BackColor = "8421631"
sSupplier1Valid = "Invalid"
Cancel = True
Case Else
sSupplier1Valid = "valid"
Me.tbs1.BackColor = "16777215"
End Select
Select Case sCostCentre1
Case Is = ""
Me.ccc1.BackColor = "8421631"
sCostCentre1Valid = "Invalid"
Cancel = True
Case Else
sCostCentre1Valid = "valid"
Me.ccc1.BackColor = "16777215"
End Select
Select Case sAccountCode1
Case Is = ""
Me.tbac1.BackColor = "8421631"
sAccountCode1Valid = "Invalid"
Cancel = True
Case Else
sAccountCode1Valid = "valid"
Me.tbac1.BackColor = "16777215"
End Select
Select Case sAuth
Case Is = ""
Me.TBAUTH.BackColor = "8421631"
sAuthValid = "Invalid"
Cancel = True
Case Else
sAuthValid = "valid"
Me.TBAUTH.BackColor = "16777215"
End Select
' Display message box warning
If sDetails1Valid = "Invalid" Or sQuantity1Valid = "invalid" Or sReqPointValid = "Invalid" Or sReqNoValid = "Invalid" Or sReqValid = "Invalid" Or sDeptValid = "Invalid" Or sDeliveryValid = "Invalid" Or sPrice1Valid = "Invalid" Or sCostCentre1Valid = "Invalid" Or sAccountCode1Valid = "Invalid" Or sAuthValid = "Invalid" Then
MsgBox "Please fill all highlighted fields on the form!!!!!"
Else
DoCmd.Save
MsgBox "Is all the information Correct?", vbOKCancel
'open report
Me.btnClose.Visible = True
Me.btnInvoice.Visible = True
Me.btnDeleteClose.Visible = False
End If
Payroll main form to post attendance record. Before I open the attendance form, I wanted to check if there is a record in the sql statement.
The code below produces error MS Acces object "Variable or With Block Variable Not Set"
Code:
Private Sub cmdPostAtt_Click()
Dim stSQL As String
Dim dbHBK As DAO.Database
[Code].....
I have a form I would like to validate input on. The field UpdatedResponsibilityCode can be updated but it can only have certain values based on the PaymentResponsibilityCode. Is there a way to force this validation?
If UpdatedResponsibilityCode = 4 then PaymentResponsibilityID can not equal 1
i would like some help on how to validate a user's entry in a form. i have a query that calculates number of hours remaining for a particular customer. when a user submits the number of hours used on the form, i want to check that this value does not exceed the number of hours they have remaining. and display a message box if they dont have enough hours remaining. any suggestions on how best to do this?
the query has a where statement like 'WHERE customer = customer_code' so customer_code is entered by the user. how do i set this so that the value for customer_code is taken from a field on the form?
I need to validate field in form so user cant not skip that data
How to do that?
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.
View 2 Replies View RelatedAccess 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.
View 3 Replies View RelatedI have a form that contains two text fields i.e.; [Scat_text] and [STyp], which each can be changed by the users. I would like to combine the results of the two fields together and validate if the results exists in a query. What would be the best way to accomplish this?
View 1 Replies View RelatedCan 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.
I have a datase that has the following fields.
Name
Comment1
Comment2
I have about 36 names and each of those names appears anywhere from 2 7 times each. Each name entry has a comment1 and a comment2.What I would like to do is create a form that allows me to choosea name and the display the comments 1 and comments 2 in text boxes.
I have made the form to allow me to choose a name and it shows one of the comment1 and one of teh comment2 in the adjacent text boxes as planned but, I want all the comment1s for Bob to show in the text box for comment1 and all of the comment2s for Bob to show in the Comment2 text box.I believe I need to concatenate the results in the comment1 and comment2 boxes, but I do not know where or how I would do that.
Hi,
On our main menu table, I only want to be able to add one record.
On the form that I have linked to this table, should you press the tab key to go through all the items / buttons, it opens a blank record screen. However, I do not want this. Any ideas?
Thanks in advance
Lee
I have 2 tables and a query to show the details of both tables on a form for an attendance database. The idea is that whenever someone is absent they have a record created.
tbl[Staff] has the following fields StaffID,Name,Team,Job Title
tbl[Absence] has the following fields StaffID, abStartDate,abEndDate,abIssue
I can set up the query to find the member of staff by name but I want to be able to use this form to add new records to the Absence table for each individual. eg I use the query to search for "Joe Bloggs" and the form shows the details from staff table and then use the form to add details to the Absence table.
Any help would be greatly appreciated
I have 2 tables and a query to show the details of both tables on a form for an attendance database. The idea is that whenever someone is absent they have a record created.
tbl[Staff] has the following fields StaffID,Name,Team,Job Title
tbl[Absence] has the following fields StaffID, abStartDate,abEndDate,abIssue
I can set up the query to find the member of staff by name but I want to be able to use this form to add new records to the Absence table for each individual. eg I use the query to search for "Joe Bloggs" and the form shows the details from staff table and then use the form to add details to the Absence table.
Any help would be greatly appreciated
Hi,
I am trying to run an append query, but instead of appending the whole table, I would like to only append a single record.
I have an append query, and it works like a charm. I can also get it to work with prompting the user for a parameter (in my case LeaseId which is a primary key). When the user is prompted and enters the LeaseId it only appends the single matching record. Works like a charm.
However, I don't want to prompt the user for the paramater. I want the user to generate the LeaseId based on the selections in two combo boxes.
So far the I do get the right LeaseId, but I have no idea how to actually pass the LeaseId to the query. I've tried the following, but I know it's completely wrong.
stDocName = "approveLease"
DoCmd.OpenQuery stDocName, acNormal, acEdit, "[LeaseId]=" & Me.buildingCombo.Column(0)
Any ideas on how to actually accomplish this?
I need to set up a preferences type form. What's the best way to accomplish this. Can I store this data in memory as a variable?
Here's what I need:
Customer Name, CustomerID.
I have been reluctant to put it in a table because this is the only data that I need.
Plx lead me down the best path.
Is it possible to create text box for search for records if I use SINGLE FORM?
i try but without effect :(
pls see my database (I want to use for record "Title")
Thanks
hello. can i refer to a single record in a detail section, and not all of them? for example if i use something like this (after update in field1):
if me.field1 = 0 then
me.field2.enabled = false
any single field1 equal to zero will disable ALL of the field2's. i would like this to work within each record independently.
I am trying to make calculations at a single record level. I have many products and I want to select only 6 of them, which I just found out that I can do it by their SupplierID. then I have a query that finds the amount of pcs that I have for each product. The aim is to determine the final weight of this 6 products. So to start I need to find the weight of each individual product by multiplying the number of pieces (from the query) by the weight of a single piece. Obviously each product weights differently, and at the end I need to add all the weights of the individual products to make the total weight of the 6 products.
don't know how to approach the problem of selecting a single record. And also I don't know what would be best to do it in a query, a form or a report.
I have a form NoWorkOrder, i have attached a command button to Print Report. The report is named No Work Order. When I'm viewing that a record in Form View and click the command button i want only that record to print out onto the report.
I'm using Ms Access 2010.
So I have a list of jobs and each job is subject to change from the original plan.
Each change needs to be documented and dated. So what I want is a form where the site can be selected and a note written. When this is saved, a record of the current time would also be needed.
The form aspect of this seems fairly straight forward to me. I just cant visualise where the 'notes' will be stored.
I would like to be able to place a button on my invoice form that will allow me to e-mail the individual invoice to the person being billed (the e-mail address is included on the form). I created a macro that works to send a PDF file of all of the records and I am having trouble figuring out how to send just the current record. I would also like to have the e-mail address automatically populated based on the e-mail address on the current record.
View 3 Replies View Related