Advertisement

12.17.2006 at 11:27PM PST, ID: 22096314
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

8.6

Auto log number when program adds a new record to an access database does not increase.

Asked by GreggWG in VB Database Programming

Tags:

I'm using Visual Basic 6.0 to build a front end for a database for storing cars.   The vehicles are stored with a log number that I want to auto populate each time a new record is added.  The problem I'm having is two fold, sometimes the number that is given using the movelast command is not accurate (curious how it decides which record is the last one?).  Also what what be the easiest way to allow two computers access to this feature and have them both be able to add records at the same time with unique log numbers?  I was thinking of having the record added with the new log number and then using update instead of add that way when the next machine attempts to pull the new log number it will see the record currently being added?  The only problem I see with this logic is that if you decided to cancel the addition of the record in that maner and it was deleted it would then skip a log number next time.

Anyway I know thats a lot of information below is the code currently being used to pull the last log number from the database and add 1 to it.  If you guys have any questions about the issue please ask away.

Private Sub Form_Activate()
  Dim templognum As Integer
  frmMain.Hide
  datPrimaryRS.Recordset.MoveLast  'This should be moving to the last record but does not appear to reliably do so
  templognum = txtfields(0).Text + 1  'This pulls the current log number from the last record and adds 1
  datPrimaryRS.Recordset.AddNew
  txtfields(1).Text = Format(Now(), ("mm/dd/yy"))  'This line is adding today's date to a text field
  txtfields(0).Text = templognum  'This assigns the new log number to a text field
  txtfields(2).SetFocus
End Sub
Start Free Trial
 
Loading Advertisement...
 
[+][-]12.18.2006 at 12:41AM PST, ID: 18157174

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]12.18.2006 at 02:38AM PST, ID: 18157537

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: VB Database Programming
Tags: auto
Sign Up Now!
Solution Provided By: rockiroads
Participating Experts: 5
Solution Grade: A
 
 
[+][-]01.01.2007 at 07:01PM PST, ID: 18225851

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]03.18.2008 at 06:56AM PDT, ID: 21150964

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20081112-EE-VQP-42