Is it possible to Increment a counter to indicate Duplicates
If I have a table which as Names
my end result I want is
Thank you for taking the time to report an issue.
What's wrong... Please write below.
programmers (and relatively new to access!). I have an issue which I'm stuck on at the moment - and I cant seem to find a resolution!
I would like to run a counter on records within a query which meet a certain criteria. And if record meets a different criteria, then I would like to restart counting from zero.
For example, I would like the counter to increment by 1 for every record that is a 'Pass', then when a 'Fail' recorded the counter reverts back to zero. I'm basically trying to record how many 'Pass' marks an idividual gets in a row.
Im not sure if I'm barking up the wrong tree, but I have the idea that a loop statement would be the most suitable - however I'm not sure on the syntax
I am using Access 2010 and I have a small database in our company network, which is using by many of my collegues. I wish to put a counter on the Main Menu Form, which gives how many times this database is opened. I mean, every time I close the database and re-open it again, the counter should increment by one. My form name is "Main Menu" where I want to put the counter on the top right corner to see how many times this database has been opened for use
So here is what I have. I have a section of list boxes labeled txtcard0 through txtcard19. Instead of having to do the same line over and over to assign a new variable to each listbox, is there a way to increment the number at the end? I've tried using & and assigning a counter variable and incrementing but neither works. Heres what I have:
db1.Form_PriceForm.txtCard0.value = "test"
db1.Form_PriceForm.txtCard1.value = "test"
db1.Form_PriceForm.txtCard2.value = "test"
db1.Form_PriceForm.txtCard3.value = "test"
db1.Form_PriceForm.txtCard4.value = "test"
db1.Form_PriceForm.txtCard5.value = "test"
Is there a way to do something like
Counter = 0
db1.Form_PriceForm.txtCard & Counter.value = "test"
? If its not possible then no big deal
I have a field called Reoffense Counter and a field called Counter, where Counter is the total count of all the records, and Reoffense Counter is the total of only those records where a new offense has taken place. Each of these fields contains a "1" where appropriate, so they can be counted. I want to find out what percentage of the records contain a Reoffense, so I think I would want to divide Reoffense Counter by Counter. I haven't been able to come up with the correct expression to use in my report.
I am trying to add a feature to my database that counts the number of times that the main menu is opened (I modified this form to always stay open in the background in order to get an accurate count) just out of curiosity.
Right now I have a table called "Count Table" with a field called "Counter" on it. This table acts as the control source on my main menu. The main menu also has a text box called "Page Counter". The "On Open" code looks as follows:
[Page Counter] = [Counter] + 1
'This line seems to work, page counter displays 1 with counter set at 0
[Counter] = [Page Count]
'This is where I run into trouble. The database does not want to overwrite the Counter value in the Count Table.
Any ideas of another way to do this? I tried doing a similar setup as shown above using the Dmax function but had the same outcome
I just starting using VBA and have little to no idea as to what I am doing. I need to write code that uses a counter. The counter goes by 1. However if the string in column C does not match the row in column C before it then the counter resets inself to
I want to add a column to an existing query that is a counter. Example of data and desired result below. The criteria is: If Name, Symbol and Date are different, counter changes; if Name, Symbol and Date are same, same counter as line above.
I read about DCount but was unsuccessful.
I have a table with one PatientNumber and TestDate fields among others. Each PatientNumber has several records with different TestDate. I added a new field called TestNumber and wanted to sort the table by PatientNumber and TestDate then update the TestNumber field to increment test numbers for each patient by test date. I was able to create the function to increment the numbers for each patient and reset the counter for the next patient, but the problem I'm having is to write an UPDATE SQL statement that does the update after sorting the data by PatientNumber then TestDate. ORDER BY or GROUP BY don't work with UPDATE queries. What's the best way to handle this?
I'm running the below code:
Dim db As Database
Dim rst As Recordset
Dim Counter As Integer
Set db = CurrentDb
Set rst = db.OpenRecordset("SELECT [Field] FROM tbl_Imports WHERE [Use] Is Not Null", dbOpenDynaset)
Counter = rst.RecordCount
& the MsgBox is coming back with a result of 1. The SQL returns 7 records so this is what I'm trying to set the counter to. Can anyone see where I'm going wrong? Hugely perplexed
What query or SQL statement would I have to use as a multiple form's recordsource to have it display record numbers 100 to 200 for example?
A solution I thought off
Adding an extra field to the table, and doing this before opening the form
Dim tb as DAO.recordset, counter as int set tb = currentdb.openrecordset("myTable") counter = 0 do while tb.eof = false tb.edit counter = counter + 1 tb!myRecordNumber = counter tb.update tb.movenext loop tb.close
then setting the forms recordsource to
select * from myTable where myRecordNumber between 100 and 200
Is there a quicker way to do this? My backend is sitting on a server online, and updating all 8712639 records everytime the form is opened might not be the smartest or quickest approach