Solved

MS Access Bound Objects.

Posted on 2016-11-17
6
58 Views
Last Modified: 2016-11-18
T#1 - Employee Name
T#2 - Month and Month # (Jan and 1, Feb and 2, etc..... Dec & 12)
T#3 - Calendar - Year (2010-2020)
T#3 - Shortfall - Employee Name, Month, Month#, Year, & Amount

Form #1 - Employee Name, Month, Year & Amount

My issues is I want the Month# to fill in based upon the Month selected in the form.  So when someone is in the form and they select Month, the coinciding Month# will fill in T#2

I'm a Newbie will need extra guidance.
0
Comment
Question by:Newbi22
6 Comments
 
LVL 1

Expert Comment

by:rodneygray
ID: 41891919
In the before update event of MonthName, execute code to set value of month
Select Case MonthName
Case "January"
    MonthNumber = 1
Case "February"
    MonthNumber = 2

....
Case Else
   msgbox("Invalid month entered. Click OK to enter a valid month.",vbyes)
   Cancel = true
   me.undo
End Select
0
 
LVL 7

Expert Comment

by:COACHMAN99
ID: 41892233
your field =month(month name)
0
 
LVL 30

Expert Comment

by:hnasr
ID: 41892479
I'm a Newbie will need extra guidance
Upload a sample database of what you have done and explain what went wrong and what you expect.
0
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 
LVL 7

Expert Comment

by:COACHMAN99
ID: 41892483
if your month field is a dropdown? (e.g. cboMonth), and your month# field is a textbox (e.g. txtMonthNum) then
on the change event of the dropdown add the following code

Private Sub cboMonth_Change()
  txtMonthNum=Month(cboMonth)
End Sub
0
 
LVL 84

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 500 total points
ID: 41892755
So when someone is in the form and they select Month, the coinciding Month# will fill in T#2
You should not store data in this manner. You should instead simply store the Date, and then use the corresponding VBA and SQL functions to format that Date as you want.

For example, to show the Month as an Integer:

Month(YourDateField)

So if YourDateField contains the value "01-01-2016", that function would return a value of 1. You could do this on a Textbox in a Form or Report, in a Query, etc.
0
 

Author Closing Comment

by:Newbi22
ID: 41893274
Thank you very much
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question