Solved

MS Access Bound Objects.

Posted on 2016-11-17
6
40 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
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
DSum for Access 6 47
Create Form using Wizard 14 39
Set focus on next field when character count = 5 9 12
Access coding 2 15
Most if not all databases provide tools to filter data; even simple mail-merge programs might offer basic filtering capabilities. This is so important that, although Access has many built-in features to help the user in this task, developers often n…
Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
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.

862 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now