Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Search | Today's Posts | Mark Forums Read
VB Databases Basics Beginning-level VB coding questions specific to using VB with databases. Issues not specific to database use will be redirected to other forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB Databases Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old February 9th, 2006, 09:34 AM
Registered User
Join Date: Feb 2006
Location: Cambridge, , United Kingdom.
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default Advice

Hi everybody,

I'm new to using VB for Access, know more about Excel. I'm working on a solution and have hit a few road bumps. Any suggestions are most welcome.

1. What is the best way of comparing two dates and setting a flag if more than one day has elapsed? I've done this in Excel, not sure about Access
2. What process can I adopt to use a Combobox to open a Form, (or several depending upon the selection)?
3. I'm trying to transfer a process from Excel into Access. Basically I have a matrix containing prices. Using the two axis values I can locate the required price. How would this be accomplished in Access?

Thanks in advance for any assistance.

Reply With Quote
  #2 (permalink)  
Old February 10th, 2006, 08:48 AM
Friend of Wrox
Points: 9,611, Level: 42
Points: 9,611, Level: 42 Points: 9,611, Level: 42 Points: 9,611, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Mar 2004
Location: Washington, DC, USA.
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts


1. You can compare the two dates using "DateDiff". You may want to doa search on this to see the syntax. Basically its:

If DateDiff("d", [StartDate], [EndDate]) > 0 Then
End If

If you are putting it into a query, you can add a column by entering the DateDiff formula in the row source:

Flag: DateDiff("d", [StartDate], [EndDate])

Then run your flag off this field.

2. Create a combo box that looks up the values you want to use to pass to your forms. Then grab that value and either pass them to a form, or check them and open the proper forms. That might look like:

Button_Click event
Dim inValue As Integer
Dim stLink As String
Dim stDocName As String

If IsNull(Me.ComboBox) or Me.ComboBox = "" Then
   'error message
   inValue = Me.ComboBox 'assumes PK is numeric
End If

'Then check the value against records if you want to open a particular form, then pass the DocName and run a DoCmd to open your form or report.

3. Can you post more data on the excel to access issue? Basically you deconstruct the pivottable (matrix) such that:

Person Jan06 Feb06 Mar06 etc
Tom 1 2 1
Joe 3 1 1
Mark 1 2 3


Person Month Value
Tom Jan06 1
Tom Feb06 2
Tom Mar06 1
Joe Jan06 3


BTW, please post in Microsoft Office>Access VBA

Reply With Quote
  #3 (permalink)  
Old February 13th, 2006, 08:15 AM
Registered User
Join Date: Feb 2006
Location: Cambridge, , United Kingdom.
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts

Thanks so much, this was really helpful. As for the Excel issue. I have two selections, the height and width of a door ... When you input a size for the door height it looks up the next highest value and selects that row. You then enter the door width and it looks up the next highest value for that column. Using an index fuction, I can then pull the data from the matrix. What I to do now is to replicate this function in Access. The basic idea you proposed seems a good starting point. I will also move over to the Access VBA forum.

Thanks again

Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Advice sarah lee ASP.NET 1.0 and 1.1 Basics 2 December 26th, 2006 12:11 PM
need advice from you alsafwa C# 2005 12 September 16th, 2006 07:44 AM
advice needed..please see sarah lee ASP.NET 1.0 and 1.1 Basics 1 September 5th, 2006 10:48 AM
some advice please? liquidmonkey Java Basics 1 May 4th, 2006 08:54 AM
Need some advice wariental HTML Code Clinic 1 March 25th, 2006 09:48 PM

All times are GMT -4. The time now is 11:23 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.