Is there any way to apply another language to Access forms. I have an issue while creating forms, as the DB values are stored in English and I have to generate two identical forms from same Table in different languages. Everything goes well till I reach a look up field like Gender. My table optional values are 'Male' and 'Female' and is good for English form but How can I change that in my non-English form without changing table value
One way to do it would be to store the actual values in the main table as M and F, e.g.
ID FirstName Gender
-- --------- ------
1 Gord M
2 Angie F
and create a reference table named [Genders] like so:
TableValue Language Translation
---------- -------- -----------
M fr_ca masculin
F fr_ca féminin
M en_us Guy
F en_us Girl
M en_ca Male
F en_ca Female
On your form, create a hidden unbound text box named txtFormLanguage, and in the Form_Load event handler populate it like this:
Private Sub Form_Load()
Me.txtFormLanguage = IIf(IsNull(Me.OpenArgs), "en_ca", Me.OpenArgs)
End Sub
Now your combo box can use the following as its Row Source...
SELECT TableValue, Translation FROM Genders WHERE (((Genders.Language)=[txtFormLanguage]));
...and have other properties similar to the following:
Bound Column: 1
Column Count: 2
Column Widths: 0";1"
When the form is opened normally (without OpenArgs)...
Docmd.OpenForm "ClientForm", acNormal, , , acFormEdit, acWindowNormal
...it defaults to en_ca (English, Canada) and the combo box displays
Male
Female
When the form is opened for fr_ca (French, Canada)...
Docmd.OpenForm "ClientForm", acNormal, , , acFormEdit, acWindowNormal, "fr_ca"
...the combo box displays
masculin
féminin
Related
I am trying to design an indididual report card for the students of my college. I have a table called "tbl_student" where their marks are stored. I have 6 columns for 6 different subjects. A student can choose only 5 subjects i.e 4 being required and Computer and Maths are optional subjects where a student can choose either one.
Now, if a std chooses Comp. then marks in the maths column is 0, likewise for maths.
I am trying to print an individual report cards for 10 students. But one of the label for the optional should display Computer or Mathematics based on the value of the column.
Here is the code i tried
'declare the variables
Dim d As Database
Dim r As Recordset
Dim comp As Field, maths As Field
'the data from the table
Set d = CurrentDb()
Set r = d.OpenRecordset("tbl_student")
Set id = r.Fields("Student ID")
Set comp = r.Fields("Computer")
Set maths = r.Fields("Mathematics")
'check for the column value
While Not r.EOF
If (comp = 0) Then
Me.labelOptional.Caption = "Mathematics"
ElseIf (maths = 0) Then
Me.labelOptional.Caption = "Computer"
Else
Me.labelOptional.Caption = "none"
End If
The result is it captions all the labels the same for all students.
If you want to display different values for different rows in report/form, you should use bound text boxes. Labels and unbound text boxes will be the same for all rows in details section. Add new calculated column for optional label in base query and use it instead of label.
I'm a very new user of Access 2016 - I have a form populated by a query, and I want to create a hyperlink out of one of the text boxes. The link should include the combined values of the workday and taskID fields for the specific record the user clicks on.
My problem is that I can't figure out how to get the value of the current record. The control source for these columns are the values themselves, retrieved via the query populating the form's record source. The following code creates the link I want, but it returns the same workday and taskID values every time, regardless of what I click on, and I can't figure out how to make it respect the current record. Any help would be greatly appreciated!
Private Sub workday_Click()
Dim link As String
Dim workday as String
Dim taskID as string
workday = Format(Me!workday, "yyyy-mm-dd")
taskID = Me!taskID
link = "http://myurl.com/" & workday & "/" & taskID
Application.FollowHyperlink (link)
End Sub
EDIT - hope this helps explain a little better
The main table driving this has workID (PK), Workday, taskID, StatusID, DateLastUpdated, UpdatedByUserID. The query used for my form selects all from this table and joins in metadata tables for Task, Status and User. There are multiple records with the same workday value and the same taskID, but never the same combination of the two. The form has a few filters in the header, and the bottom section is a datasheet. In the datasheet I have a combo box used to update StatusID, all other fields are disabled and locked. My hyperlink click event is on the Workday field, and is working in that it creates the appropriate URL, it's just populated with the same taskID and workday values, eg even if I click on the row for "2016-07-12" "456", I still return "2016-07-11" & "123"
Here's a simplified version of what the data looks like. My goal is that when the user clicks on a workday, they are taken to a hyperlink made up of both the workday and TaskID of the row clicked on.
Workday TaskID
2016-07-11 123
2016-07-11 456
2016-07-11 789
2016-07-12 123
2016-07-12 456
2016-07-12 789
2016-07-13 123
2016-07-13 456
2016-07-13 789
I think I actually solved it - the problem was that since almost all fields were locked and disabled, the current record wasn't technically the row I was clicking on. I set Enabled = Yes for the Workday column, and now it's working as expected.
I am creating a SSRS list report based on this SQL:
select name, job_id, job_title from HR
name job_id job_title
--------- --------- ---------
Mike Jones 123 Manager
Mike Jones 775 Analyst
Patty Bea 562 Director
Patty Bea 964 Deputy CFO
After creating the design and previewing the report, I get 4 pages based on my SQL results.
When a name has more than one jod_id and job title, I would like to list both on one preview page of the SSRS report.
Your preview looks like your desired result - 'I would like to list both on one preview page ' - rather than the 4 page current result.
If you haven't done it - you'll want to only GROUP on the name and use a LOOKUPSET to get all the values associated (and use a JOIN to combine them into a single string):
=Join(LookupSet(Fields!name.Value, Fields!name.Value, Fields!job_id.Value, "DataSet1"), ", ")
The LookupSet looks up all the results that match the name field (argument 1) to the name field of the dataset (argument 2) and gets the job_id field (argument 3) from DataSet1 (argument 4).
For the job_title field, do the same but change the job_id field to job_title.
i am a beginner at MS Access. I would like to know what is the possible way that to fetch data automatically based on what i select from another row in the same table. I have table as like below.
ID (autonumber)
Airlines (short text)
FlightNumber (short text)
From above case, there could be many flight numbers under an airline. Therefore, in my table, i have entered many flight numbers for same airline. What i want to do is like, when i select a flight number in a dropdown list, i want to database to select correct Airline based on data i have entered in the table.
Any held would be much appreciated. Thanks
What you need is, Cascading ComboBoxes. Where ComboBoxes cascade based on the selections made previously. I am expanding your example. For simplicity, I have a form with only two ComboBox controls. The table which has the flight info is tbl_FlightInfo. Let us say it has the following structure.
flightID | flightCompany | flightName
------------+-------------------+--------------
1 | British Airways | BA500
2 | British Airways | BA707
3 | Qatar Airways | QA200
4 | Virgin Atlantic | VA303
5 | Virgin Atlantic | VA404
The first ComboBox (flightCompanyCombo), would have the RowSource as,
SELECT flightCompany FROM tbl_FlightInfo GROUP BY tbl_FlightInfo;
This will list all the company you have in the table, the second ComboBox (flightNameCombo) could have a RowSource as,
SELECT flightName FROM tbl_FlightInfo;
Now this is to make sure the ComboBox is populated with all Flight names initially. Then in the AfterUpdate event of the flightCompanyCombo, you can requery the flightNameCombo, the code would be something like,
Private Sub flightNameCombo_AfterUpdate()
Me.flightNameCombo.RowSource = "SELECT flightName FROM tbl_FlightInfo " & _
"WHERE flightCompany = '" & Me.flightNameCombo & "'"
Me.flightNameCombo.ReQuery
End Sub
This way if you select British Airways in Company Name Combo, the Flight Name combo, will have BA500 and BA707.
For more information :
http://www.utteraccess.com/wiki/index.php/Cascading_Combo_Boxes
http://www.fmsinc.com/microsoftaccess/forms/combo-boxes/cascading.html
http://www.fontstuff.com/access/acctut10.htm
I want to create sequence number in my order form that after save button it generate a Order No in Order No field of table, as I m not much knowledge in VBA but got from internet some codes which i try to implement but its not working
The code is given below please see reply if there is any edit or where i m mistaked
Table:
ID | date | party Name | Order No| Item | qty | Rate | Amount |
Private Sub save_Click()
If Me.orderno = Null Then
Me.orderno = Nz(DMax([Order No], Order), 0) + 1
End If
End Sub
If the name of the table is 'Order', the following should work:
If IsNull(Me.orderno) Then
Me.orderno = Nz(DMax("[Order No]", "Order"), 0) + 1
End If
A few other comments:
Date is a reserved word and should not be used as a field name, so best to change it to avoid problems. http://office.microsoft.com/en-us/access-help/access-2007-reserved-words-and-symbols-HA010030643.aspx
It is also poor practice to use spaces in field names.
The problems here were quite obvious, however, for future reference, you should state what error you are receiving and which line it occurs on. 'Not working' does not provide any clues.
Add the line
DoCmd.RunCommand acCmdSaveRecord
at the end, to insure that the record is saved.
Make sure that the code is actually running and that orderno is bound to the field orderno.
If it still doesn't appear to work, step through he code to see what is happening.
As for the comment about autonumber, and autonumber is fine if you don't care about gaps in the numbering sequence, which will eventually occur using an autonumber.