Modules & VBA :: Greatest Common Divisor
Sep 16, 2014
How to find Greatest common divisor in MS Access?Have a 2 columns in my form: 1) amount; 2) GCD
E.G
amount | GCD
1200
500
400
100
Should be after runing code
amount | GCD
1200 | 12
500 | 5
400 | 4
100 | 1
I was looking form some function but I found only for Ms Excel :/
View Replies
ADVERTISEMENT
Sep 13, 2005
Situation:
When logging into my network I record several key information about every computer. The only two fields that concern me at the moment are Username and Computername. I am trying to retrieve the user of each machine. My problem is sometimes users will log into machines that are not theirs. This situation can make my queries somewhat inacurate as I will explain below.
Sample data:
Username Computername
JSmith Comp1
TJones Comp2
TJones Comp1
JSmith Comp1
Perfect World:
What I would like is to individualise this information to the specific party in one complete sql statement. So that I can run the statment with each machine as the variable and allow it to pull the appropriate information for the user.
Example:
JSmith uses comp1
Tjones uses comp2
What I have tried so far:
Max() this seems to treat them as alphabetic characters and returns the user with the highest alpha/numeric value that has logged onto the computer.
Min() see Max()
Last() this seems to be the most accurate option I have, because it should be correct 90% of the time. Though it still has its inherent flaws as the primary user does not have to be the last user necessarily.
I have tried to look for information in both my help file and this website, if someone would please point me in a direction I would greatly appreciate it. Thank you.
View 8 Replies
View Related
Oct 31, 2006
I have a table that has multiple Account Numbers and their Balances, I need to only pull the records that have the largest value.
Example: Acct# Balance
2 $1.00
2 $500.00
2 $300.00
3 $25.00
3 $400.00
I need my query to pull only these records Acct # Balance
2 $500.00
3 $400.00
Please help me figure out how to only pull those records
View 1 Replies
View Related
Sep 27, 2007
Hi everyone
This seems like a really simple problem, but I can't figure it out...
-I have a table that contains machine problems, and their duration times
-I made a query that filters the problems based on the date of occurance, and adds up the duration times for a specified problem for the date range
Question: How do I get it to display the top 5 (i.e. 5 with the longest duration) problems? Can the max function work for more than one record?
:confused:
View 2 Replies
View Related
Aug 14, 2007
I have a table that keeps track of how many times an account is listed. I want to write a query that will only return the greatest number of occurences for that account. For example if acct 12345 has 3 occurences in the database I only want to return the information that is associated with the #3 occurence. As stated there is a field that calculates the number of occurences for each account so in this case there would be a record for 1, 2, and 3 occurence so I only want to see #3. Hope that makes sense. Thanks!
View 3 Replies
View Related
Sep 5, 2005
I have 2 tables called Table1 ( has field called Mydata) and table2 (has Field called YourData).
Mydata has followind data 1, 2, 3 and yourData has 2,3,4
2 and 3 are comman data. how can I write query or type of function I can use to bring comman data.
I have used Union table that brings all record.
View 2 Replies
View Related
Nov 27, 2005
I am trying to add a common dialog to my form from the toolbox and get the following error 'you dont have the license required to use this ActiveX control. Is there any way I can sort this out? I am using Access 2002. I am getting desperate and any help would be much appreciated
View 3 Replies
View Related
Sep 27, 2006
Hi,
I did a search on common access errors and other errors that you would want to trap and got the following results:
Cannot update. Database or object is read-only
Operation must use an updateable query
General error Unable to open registry key
Could not find file
Could not use '(unknown)'; file already in use
Table 'tblTable' is exclusively locked by user 'Admin' on machine 'MyMachine'
Too few parameters. Expected 1
Either BOF or EOF is True, or the current record has been deleted
Item cannot be found in the collection corresponding to the requested name or ordinal
The search key was not found in any record
If you know any extra errors, can you please add them to this list?
Regards,
B
View 6 Replies
View Related
Mar 27, 2008
I am OK with a number field as I can put it in Excel and use =Mode().
But that wont do text such as lastname, suburb etc. I can do suburb by doing postcode but no such equivalent from some others I want to do
View 4 Replies
View Related
Oct 12, 2004
Hey there,
Is there a listing anywhere online for common regular expressions for validations rules? In other words, is there something that shows how to construct validation rules for things like phone numbers, addresses, postal/zip codes, serial numbers, math equations, etc. Two in particular that I'm looking for are phone numbers and postal/zip codes. Every time I try to wrap my head around the formula for a phone number (with area codes, an optional 1 in the begining, making sure no leading zeroes, making brackets around area codes optional, etc.) I only get a headache :mad: . I'll get it eventually, but a quick reference in the mean time and for future use would be very helpful.
Thanks so much,
Gibby :)
View 2 Replies
View Related
Oct 9, 2007
It just occurred to me that I use certain variables in several of my routines. Maybe you've done the same... something like:
Dim db as DAO.Database
Dim rst as DAO.recordset
Dim qdf as DAO.QueryDef
Now, if it's re-used in many routines, wouldn't it make more sense to make it a public variable, and set them to whatever you need it for a certain routine? Would it be more efficient than having to re-initializing and discarding it for every routine that used it? What problem would one expect from making them public?
Also, since it's very common to set db = CurrentDb, would it also make sense to set it publicly, and for cases where you aren't using CurrentDb, use a private variable just for that one?
View 7 Replies
View Related
Oct 22, 2007
Is there a way, similar to Excel's "personal.xls", to put all my reuseable Access code into one central module?
Thanks in advance.
View 7 Replies
View Related
Jun 15, 2006
Hi guys,
I am having problem with a query.
I have to tables. One named wire and the other named Input.
As my title says there is not unique ID for the tables to relate.. the only thing to relate is one ID where is not unique for all the rows
In the Wire Table I have 3 rows using the same ID, lets say 123.
In the Input Table I have 1 row using the same ID as above, i.e. 123
I need to select a couple of fields from Wire Table and 1 field from Input Table
The only relationship I have is the ID 123.... since the ID in Wire Table is repeated in 3 rows.... I would like to use the same value from the Input Table to be the same for the 3 rows in the other table.. Below is an example:
Wire Table:
ID Group
123 A
123 B
123 C
Input Table
ID Description
123 Analog
My wanted result would be
Group Description
A Analog
B Analog
C Analog
I tried using the Left join or Join function, but somehow the resulting table has many duplicates of the rows...such as:
Group Description
A Analog
A Analog
A Analog
A Analog
A Analog
B Analog
B Analog
B Analog
B Analog
...
Any Idea on whats going on and how can i solve this problem????
Thanks in advance. Your Help is much appreciated
View 1 Replies
View Related
Dec 1, 2006
I have my form where each records image displays as you scroll through the records. I want to add a control similar to the file dialog control, where users can browse to an image file on their machine, and then preview it and Update it.
Can anyone walk me thru how to do this?
View 1 Replies
View Related
Jul 15, 2005
Is there anyway to put common dialog box in MS Access Form. There is an option from ActiveX controls icon, but gives an error message, saying I do not have licence to use it ?
View 8 Replies
View Related
Jan 23, 2008
Hi all,
I am new to microsoft access. I've got one question that can't solve.
I am making database with several items. Under each item, there got different field lists to fill in. So I made several forms for each of them.
In main form, I put one combo box to choose the item and one common button. So how can I write the code to open the several different forms,one at a time, by clicking one button according to the value that is chosen from combo box??
thank in advance.
View 7 Replies
View Related
Aug 12, 2005
Hi,
I have two tables of titles (DVDs and CDs). Each table has a price associated with each title in an adjacent column. I would like to match the titles between them and compare prices. Any help would be greatly appreciated. Thanks. EDS
View 2 Replies
View Related
Jul 23, 2006
Hello,
Firstly I would like to state that i have very little knowledge of Access databases (my job is not computer related) but I am trying my best to get a few issues sorted...
So here it goes: I have 2 tables, one large table with about 3-4000 rows(horizontal lines), and a smaller table with only about 1000 rows.
The rows in the big table contain Products (name, dates, adresses, phone numbers etc) and every product has a 'Codename' in a column-line (vertical)
of the big table. (there are about 3000-4000 products)
In the small table there exists a similar column-line (vertical) that contains 'Codenames' of the Products listed in the big table, but there are only ~ 1000 'Codenames' not the full 4000 ! The reason for this is that in the small table there exists another column-line(vertical) that for every code listed (in the small table) contains a certain specific "description".
My task is to get all the 1000 "descriptions" from the small table inserted into the Big table accordingly to their proper 'Codename'. This means createing a new column in the big table and: if the codename exists in small-table insert the description in the new column-cell, if the codename doesnt exist in small-table leave new-cell empty...
How do i do this ? :) Im guessing some coding is envolved.. and i have no clue whatsoever....
Thank you,
George P.
View 2 Replies
View Related
Aug 23, 2006
Hello to all. This is my first post on this forum. I'm currently working on a database for my company and would like to get some more guidance from you all. I work at a helpdesk. I'm trying to create a database that allows me to search for common error messages. My co-workers and I would be inputting the messages. I would like to be able to set up a query to search for these messages for future troubleshooting. I’m just looking for a start on what the tables and fields should be and how we can input the messages. All help is greatly appreciated.
View 3 Replies
View Related
Mar 30, 2005
I'm a complete novice when it comes to dynamic data so forgive my ignorance.
My database contains details of projects in progress. A user can click a link in a list and
display a summary of that project (okay so far - I've done that bit) - in the database though there
are two tables the second one lists project events/comments (title, date, job number and description) - when something interesting
happens during a project we add to the 2nd database a summary of what happened (we made 2nd db because the list
of things happening could be one entry or 50 entries) - the tables are links by the job number.
On the web site I would like that when a user clicks the link to display the info about a project it all also pulls info from
the second db but for the project with the same number.
I've hard coded a similar thing before "select * from tblProducts where category like 'Off Road and Dirt Bikes'" but in
this case instead of hard typing 'Off Road and Dirt Bikes' I'd like it to automatically insert the job number of the project
being looked at from the first database.
I don't think I've explained this as well as I could've - but if anyone could help I will be really grateful.
View 1 Replies
View Related
May 23, 2013
I'm a beginner trying to build a simple database for work. I'm trying to track the performance of bonds from month to month, in this case January-April. Each bond has a serial number called Serial_ID, but we wanted to create a record for each month we own the bond, so we created a primary key combining Serial_ID and start date called Serial_Start_Date. So if we own one bond, its January record would have a primary key of "4553123A 2013-01-01" and February would be "4553123A 2013-02-01". I created a form that allows a user to select one individual month's bond and display that month's return. However, I'm struggling to find a way to create a form that allows me to just select the Serial_ID and display the four month's records. Right now there is only one table in the database.
View 1 Replies
View Related
Nov 27, 2012
i have been trying to combine data from 2 different sources, to make unique rows: here it is my situation Data in DGV already in dgv, Unbound:
column1 | Qty
"Sugar", 100
"Salt", 100
"Color", 200
"Malto", 150
Data in datatable:
column1 | Qty
"Sugar", 80
"Salt", 60
"Apio", 25
"Lemon", 60
"Color", 60
So i want a control that matches the column1 in datatable against DGV.Column1, and if value matches only add second column value and if not, then make a new row in DGV.
Final decided outcome:
column1 | Qty|Qty2
"Sugar"| 100 | 80
"Salt" | 100 | 60
"Color"| 200 | 60
"Malto"| 150
"Apio" | | 25
View 1 Replies
View Related
Jul 31, 2007
Hi, when I run a simple append query, I get the following message below (See attached) I tried the solution in microsofts website that I have to set all text fields to AllowZeroLength to Yes, and i did that in both the table the data comes from, and the table the data is appended to. Still cant get it to work? Any other suggestions or is there somthign simple that im missing?
View 3 Replies
View Related
Aug 9, 2013
I have two tables, identical in terms of structure (number & names of fields etc.) but different in terms of content (records not necessarily the same, some may be common to both, some may only be present in one or other table)
I want to set up a query to count the number of records which are present in one table (Table A) but not in the other (Table B) using a common identifier field, and put the numerical result in a text box on a form (i.e. use the query as the control source for the text box)
I've managed to come up with the following which provides the list of ID's :
Quote:
SELECT tblA.CommentId
FROM tblA LEFT JOIN tblB ON tblA.Id = tblB.Id
WHERE tblB.Id Is Null;
Which will come in useful elsewhere but how do I adjust this SQL to only return the number of records? I think I have to use COUNT(*) somehow but I'm not familiar with it and not sure of the syntax?
View 2 Replies
View Related
Oct 16, 2013
I am seeking to generate a common Header for each page in a report. Is this possible?
View 2 Replies
View Related
May 31, 2013
I am trying to form a join between two separate databases. Database 1 has a column (Gene_Name2) that consists of common names of human genes. In this database there is only one name for each gene per field. The other Database 2 has a column (Gene_Name2) that has various names for the same gene in each field. Most genes have been given different names over time.
I want to join the databases into a separate query database so that all of the information in Database 1 is retained and only when the name in Database 1 matches one of the names in Database 2 does the row of information get tacked on to the query database. The problem is that in a normal query the text in both Gene_Name columns do not match and the query returns no matches. I have tried Instr and like criteria statements with no luck. The following is an example of what I have and what I need.
Database 1
Chrom Gene_Name1 Data
Chr1 ATC XYZ
Chr2 IDH2 ZYZ
Database 2
Gene_Name2 Data
ATC;ORF34;NM_123 ABC
ORF65;IDH2 IGH
Joined Query
Chrom Gene_Name1 Data Gene_Name2 Data
Chr1 ATC XYZ ATC;ORF34;NM_123 ABC
Chr2 IDH2 ZYZ ORF65;IDH2 IGH
View 7 Replies
View Related