General :: Using Like Function With Data From A Form?
Dec 24, 2012
I have a ICT exam on databases in January for A2 ICT. It is based on a sixth form college. I need to add new units for the courses via a form, with the unit being uniquely identified using a Unit Code
The Unit Code consists of the first 3 letters of the Subject Code, the first 2 letters of the Description of the unit and a number.
Eg Subject ID : ARA001 and Description: Culture will have a Unit code of ARACU1
I'm trying to find a way to automatically create the unit code on the form. The first two bits have been solved fine,however, i have had difficulty of putting the number of the end. It seems easy in practice as i need to find a Unit Code like the one i have on the form but find the maximum number of a identical code and add one to it. I thought if i did
Like "[Forms]![frmaddnewunit]![txtUnitCode]*" as the criteria on a query with the field being Unit Code from the Unit table it would find data like the one on the form but it doensn't.
I thought i would use the data from the query and use Max(Right([UnitCode],1))+1 to get the number and add this to the code in the unit
This formula on the unit code text box on the form solves the first two bits of the problem
but i need to find a way to find unit codes thsat exist similar to the ones that are created and then find the maximum number and add one to it so i have a valid unit code
e.g
if on the form i select Subject ID ARA001 and Description Culture
The unit code will display ARACU.
I then need to find unit codes similar to this (There is one that already exists ARACU1) and find the max number on the end and add one to it
So ideally the code that will be automatically generated in this case would be ARACU2
I have a form and a button it to copy the data to save me time when 99% is duplicated Ie If I enter 2 siblings data I fill one out then copy it and only change the siblings name a bdate.Then problem is it does copy the data but locks up the form. I have t X out the form when I do a warning comes up asking me if I want to empty the clipboard of, in short, a massive amount of data. I say yes and then reopen the form and there is the duplicate data ie 2 records.
Private Sub Command163_Click() 'Coppy record Button On Error GoTo Err_Command163_Click DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70 DoCmd.DoMenuItem acFormBar, acEditMenu, 2, , acMenuVer70 DoCmd.DoMenuItem acFormBar, acEditMenu, 5, , acMenuVer70 'Paste Append
When dispatching equipment we enter the address and details onto a form. The data on this form saves into a table.
The form always opens on next record so at the minute for example its 22900.
I would like instead of printing a copy for the company, for a button to click on the form to do the following:
Save "current record" with all data entered by user into a folder on the computer automatically with a file name of ""current date""customername"".
It would save in a folder also called "current date" if this had not already been created i would need the code to firstly create this prior to saving the file as a pdf.
I have a form into which I scan a serial number in one of its text boxes, I can then select search and am presented with a report relating to that serial number. All simple so far. Now for the dilemma... The barcode I scan consists of 15 characters like so, 53423PP98765432, numbers-PP-numbers.. the problem I have is that I only need the numbers after the PP's, in other words the last 8 digits. My question is, is there something I could do to make the text box omit the first 7 characters automatically, leaving me with the 8 I need, instead of me having to curser into the middle and manually delete the first 7 characters. I only need the last 8 because of the link with another database that only uses the last 8 digits.
Also, on the device I scan, there are 2 other barcodes, above and below the one I need to scan. If I scan one of the others by mistake, I have to highlight and delete the results to try and scan the middle barcode. The other barcodes also have a different length to the one I need. So is it possible to write some code that says, ok, you have scanned a barcode with 10 or 12 digits, we don't want either of those, so deletes it for me to try again, but then recognizes the 15 digit barcode and auto deletes the first 7 characters as mentioned above.
it is zip file unable to get the size lower yet minimal amount in database I have 2 tables and one form when I create an query on the form the form then becomes that I cannot enter data in it or edit etc
I created a form that allows users to enter data into the fields and populates the table.But can I have it do that and populate instead of one table, two tables?
Table one is for person ID Table two is for number of absences
I created a one-to-many relationship with the update/delete option selected. It didn't work when I wanted to add new data into the tables (via form). Then I tried a many-to-many relationship (with a third table) but it doesn't seem logical to do so, as I only need to add particular data into one table, but need a field from the 1st to differentiate records.
(table 1 = one record per person, table 2 = multiple records for 1 person)
I am trying to create a form for data entry. I would like the Total Balance in the last record to become Total Cost in the new record. However, if the total balance in the previous record is =<0 it prompts the user to enter a new total cost else use the last Total Balance. The form in question is FrmSubClients in the attached file.
So, I've got a frmCustomer and want to link the form to frmNewWorkOrder using a button.
More precisely when I choose/scroll to a customer and click the button "New work order" to autofill data from selected client from frmCustomerto frmNewWorkOrder (First and Last name, telephone number and client ID).
I have created a DB to store my students records, eg: Student Number, English Name, Chinese Name, Birthdate, Class Number, Age, and exam scores, I also have a photo frame to display the students photo.
In the data sheet I have an ole object field where I add the photos, the thing is it means I need to manually add this to the data sheet, whereas I can add all the other details directly from the form "Add New Record" and also search, delete or edit all from the form.
I have searched and searched but I cannot find any info that accurately explains how I may add the photos to the c where I have placed a button "Add Photo". I assume I need to create a macro and assign it to the button (on click) then this would need to open a search file location box where I can find the photo and select it to be added to the file.
The point is I wish to be able to do all the adding, deleting and editing from within the form and not have to enter into the data sheet at all.
I am trying to send out data collection emails to fill in my records but it will only let me select fields from single access tables, I want to be able to get them to fill out all the fields as entered in my forms, which contain sub-forms and therefore links to multiple tables.
I want to make my Courseid field visible in my form based on whats entered in my StudentID Field.I've used the following code but i'm getting an "Else Without If" error:
Code:
Private Sub Form_AfterUpdate() If Me.studentID = "Pending" Or "Rejected" Or "pending" Or "rejected" Then Me.Courseid.Visible = False Else: Me.Courseid.Visible = True End If End Sub
If the studentID is a number then i want the course to become visible but i don't know how to use the isNumeric function this way.
I want to run a function when my application closes. But it must run in all cases, so running it on the last form, or in a hidden form, is not good enough. Even if I'm in design mode with no forms loaded, I want it to run.
For background info - my app is locked down tight against clients poking around. I have got a way for me as developer to get into the "back door", and what I'm trying to do is make sure when I'm finished doing my stuff that the app is locked again without me having to remember to do it.
I'm trying to add a couple of buttons to the QAT to run public sub's saved in modules within the DB but for some reason they are not showing when I try to customise the toolbar?The sub's are fairly straightforward (they just open forms) and are saved in a module within the project :
Code:
Option Compare Database Option Explicit Public Sub NewEntry() DoCmd.OpenForm "DataEntry" End Sub
[code]....
But when i try to add them to the QAT, they are not visible?
I have a simple data entry form based on a table. However I have a few fields that I do a lookup in a field on the form from a query, and yes I know I should not have a lookup in the control source however, this is the way that I will be doing it on this occasion.
=DLookUp("[Salary]","[Salary Query]")
How I get the value from this unbound field to enter into the actual field in the table. Do I bring the actual field into the form and hide, and do some sort of after update, as I have tried and it does not work.
I have called the unbound field with lookup "Salary Level Base" and the actual field in the table is "Salary Base".
I created a new field as a text box, converted it to Combo box, then the Values are pulled from a query and all that works fine.
I have a form that opens and displays these Fields in a Data Sheet view and the new Combo box doesn't drop down and is flagged as a text box in the property bar but no way to change it??
I need the drop down like the other Category field I have, that works but this one doesn't.
See screen shot.
You can see in the Category field, there is a Drop down, but in Category II there is not, even though this is a drop down field. - BUT in this data sheet view it doesn't show it as a drop down.
I've written an application in VB.Net and now I need to transfer the data on textboxes on a form to a report for printing. Only the data on the form is what I want to preview and print.
I am creating a form for data entry into my main table. It shows all the fields including a name, date, id number etc.
I am trying to put a subform on the form containing a query. The query has two filter parameters fed from two unbound boxes on the main form (date and name). Their purpose is to filter records on the query to just show those for one person on one day. It also calculates a duration based on a start and end time. The query results are ok.
I can't get the query to display properly in the subform.
Subform Properties/data/source object is set to the query name. I'm told i have to link the master fields and child fields but when I try I get the error 'can't build a link between unbound forms'. I thought all that was necessary to bind forms was for there to be a common field between the form and query? Both contain fields from the main table including date, name, start time and end time etc.
I am currently using SendObj method to send an Outlook email and selected report as an attachment using the current form's data. This is triggered by a button click.
This is working well apart from having to use 'ClickYes' to outwit the Outlook 2012 security system.
However I now need to selectively send an extra pdf file with some of the emails based on a Yes/No field on the form. This is a fixed file on my local C drive.
I think I have to use automation to do that but I can't find a method of specifying the report I currently use in the SendObj method in the .Add.Attachment line.
Do I need to run the report and then save it so that I can specify the path and name in the .Add.attachment line followed by code which will delete the file? or is there a means of combining the code I currently use in SendObj to create the pdf object with automation option?
I have working code for both attachments at present but they send separate emails and I would prefer to combine them if possible.
Dim var1 As Variant, var2 As Variant, var3 As Variant, var4 As Variant DIm var5 As Variant, var6 As Variant, var7 As Variant, var8 As Variant Dim var9 As Variant, var10 As Variant Dim i1 As Long i1 = 1 Do Until i1 > 10 var & i1 ??? = "0" & i1 & "." & txt1 & "." & txt2 i1 = i1 + 1 Loop
How to make concatenate var + i1 to make loop function?
Is it possible to compare rows, ie in excel I could do =A1=A2 to compare certain fields then if they are different/the same highlight.Is there a way of doing this in access?
I now try to rework on an old project but when I try to run some queries I get an error message: Undefined function 'Date' in expression . The same happen for the Format function.Both are built in Access functions