Live Chat & Podcast at 1:00PM Eastern on Sunday!
There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
Search
Business Applications
Tag Cloud
access acer asus bios bsod computer crash desktop driver drivers error ethernet excel freeze gaming hard drive hardware hdmi internet laptop malware memory modem monitor motherboard network printer problem ram registry router security slow software sound toshiba trojan ubuntu 11.10 uninstall usb video virus vista wifi windows windows 7 windows 7 32 bit windows 7 64 bit windows xp wireless
Search
Search for:
Tech Support Guy Forums > Software & Hardware > Business Applications >
Solved: Access 2007 Problem

Reply  
Thread Tools
Technodruid's Avatar
Member with 70 posts.
 
Join Date: Sep 2010
Location: Oregon
Experience: Advanced
08-Sep-2010, 10:21 AM #1
Solved: Access 2007 Problem
Hello, new to the forums, I am taking over a database and Im trying to clean up some of the Code as well as make it more user/Design friendly. In this case I am trying to get rid of about 100+ querys with a bit of VBA code, now I dont mind using queries but i think it would be more simplistic and make for less bloat using the VBA. unless there is a way to do it in SQL then i could do it there also.

Here is what I need to do.... I have tblWorkCode with User inputted data, and template2_Hold1 with Data imported from an Excel Sheet. I need to compare Resource Group, Country, Rate type and Workforce with Resource Group, Working_in _Country, Rate type and Workforce.

Based on the results tblWorkCode I need to have WLID and WID populate the same fields in template2_Hold1. If the Comparison doesn’t come back with a combo then it would prompt the user to create the entry into the tblWorkCode.

Now if it matches a combination of the 4 but the WLID and/or WID are Null then the user will be prompted to enter just the WLID or the WID (this will be based on information outside of the Information in the DB). This part I shouldn’t have much trouble coding.

I hope this makes some sense, and Thanks for any help given. Added a sample of the 2 tables and some of the code Ive been trying. The Code is in the VBA on the button form. Ill probably just put it in a module if we can get it working.

Thanks in advance for any help.
Attached Files
File Type: zip Test1.zip (23.2 KB, 2 views)
OBP's Avatar
OBP OBP is offline
Computer Specs
Distinguished Member with 14,665 posts.
 
Join Date: Mar 2005
Location: UK
Experience: An old Basic Programmer
08-Sep-2010, 11:51 AM #2
Technodruid, welcome to the forum, that is quite a task you given yourself.
I must admit the old adage of "If it ain't Broke don't fix it" comes to mind.
Sorry I can't open Access 2007 databases.
Technodruid's Avatar
Member with 70 posts.
 
Join Date: Sep 2010
Location: Oregon
Experience: Advanced
08-Sep-2010, 12:50 PM #3
Thats the Problem, for what client wants, it is Broken if you want I can paste the VBA code I was trying but its not populating the tables properly anyway.
OBP's Avatar
OBP OBP is offline
Computer Specs
Distinguished Member with 14,665 posts.
 
Join Date: Mar 2005
Location: UK
Experience: An old Basic Programmer
08-Sep-2010, 12:52 PM #4
What isn't it doing?
By all means post the code, plus some details about what it should do to what fields.
Technodruid's Avatar
Member with 70 posts.
 
Join Date: Sep 2010
Location: Oregon
Experience: Advanced
08-Sep-2010, 01:30 PM #5
The Code
Dim RG As String
Dim Cntry As String
Dim RT As String
Dim WF As String
Dim BC As String
Dim RG1 As String
Dim Cntry1 As String
Dim RT1 As String
Dim WF1 As String
Dim BC1 As String
Dim LRec As String
Dim TempHold As Recordset
Dim WorkCode As Recordset

Set TempHold = CurrentDb.OpenRecordset("template2_Hold1")
Set WorkCode = CurrentDb.OpenRecordset("tblWorkCode")

RG = TempHold![Resource Group]
Cntry = TempHold![Working_in_Country]
RT = TempHold![Rate Type]
WF = TempHold![Workforce]


RG1 = WorkCode![Resource Group]
Cntry1 = WorkCode![Country]
RT1 = WorkCode![Rate Type]
WF1 = WorkCode![Workforce]

Do
Loop Until RG = RG1 And Cntry = Cntry1 And RT = RT1 And WF = WF1 And TempHold!WLID <> Null And TempHold!WID <> Null
TempHold.Edit

If RG = RG1 And Cntry = Cntry1 And RT = RT1 And WF = WF1 Then TempHold!WLID = WorkCode!WLID And TempHold!WID = WorkCode!ID
TempHold.update

Its Supposed to cycle thru all the records and Update tbltemphold fields WLID and ID. If the WLID or ID
Have a Null value then it will pop up a Form for the user to manually enter, if there are records between the 2 tables that dont match I will be setting up a form that the user will beable to update Table workCode for.
OBP's Avatar
OBP OBP is offline
Computer Specs
Distinguished Member with 14,665 posts.
 
Join Date: Mar 2005
Location: UK
Experience: An old Basic Programmer
08-Sep-2010, 01:38 PM #6
I don't see any recordsets?
Technodruid's Avatar
Member with 70 posts.
 
Join Date: Sep 2010
Location: Oregon
Experience: Advanced
08-Sep-2010, 01:59 PM #7
Set TempHold = CurrentDb.OpenRecordset("template2_Hold1")
Set WorkCode = CurrentDb.OpenRecordset("tblWorkCode")
OBP's Avatar
OBP OBP is offline
Computer Specs
Distinguished Member with 14,665 posts.
 
Join Date: Mar 2005
Location: UK
Experience: An old Basic Programmer
08-Sep-2010, 02:05 PM #8
OK, after the .update you need to .bookmark the each recordset so that it nows where it is.
You also need a .NextRecord for each one to step through the records.
OBP's Avatar
OBP OBP is offline
Computer Specs
Distinguished Member with 14,665 posts.
 
Join Date: Mar 2005
Location: UK
Experience: An old Basic Programmer
08-Sep-2010, 02:20 PM #9
This is part of a For next loop that adds to a table rather than updating

With rstable
.AddNew
!date = Me.Report_Date
!team = team
![Idle Code] = Code
![Agent ID] = Val(Agent)
!Agent = Name
!Duration = Timed
![Time In Code] = Val(tic)
.Update
.Bookmark = .LastModified
End With
End If
End If
If rs.EOF Then Exit For
rs.MoveNext
Next count
__________________
OBP
I do not give up easily
Reply

THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.

Search Tech Support Guy

Find the solution to your
computer problem!




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
WELCOME TO TECH SUPPORT GUY! Are you looking for the solution to your computer problem? Join our site today to ask your question -- for free! Our site is run completely by volunteers who want to help you solve your computer problems. See our Welcome Guide to get started.
Thread Tools


Similar Threads
Title Thread Starter Forum Replies Last Post
Solved: Access 2007 Sync'd Combo Box Value Not Displaying johnthegeek Business Applications 6 27-May-2010 12:54 AM
problem with Access 2007 luc15 Business Applications 8 16-Nov-2009 09:06 AM
Solved: Access 2007 Alphabetic Sort Problem look_b4u_leap Business Applications 8 29-Jan-2009 11:49 AM
Solved: Access 2007 - Form Tabs Problem look_b4u_leap Business Applications 4 06-Jan-2009 05:00 PM
Access 2000 App displays #Name? in Access 2007 pdesjardins Business Applications 1 31-Jul-2008 06:00 AM


Facebook Facebook Twitter Twitter TechGuy.tv TechGuy.tv Mobile TSG Mobile
You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 10:19 PM.
Copyright © 1996 - 2011 TechGuy, Inc. All rights reserved.

Powered by Cermak Technologies, Inc.