Brain Dump

Dec 6, 2005

I have a lookup form that is basically one combo box that holds my user names (Combo0). I need to use the afterupdate event to open my form (frm_tc1) and filter that users records. If no records are found I need it to prompt me to add a record. If yes is selected I need it to open frm_tc1 in add format, and if no is selected I need it to go back to the switchboard menu.

Here is the code that I have so far:

Private Sub Combo0_AfterUpdate()
'On Error GoTo Err_combo0

Dim stDocName As String
Dim stLinkCriteria As String
Me![Combo0].SetFocus
DoCmd.FindRecord Me![Combo0], , True, , True
If MsgBox("User Record Not Found. Do you want to add a new record?", 4) = 6 Then
DoCmd.OpenForm "frm_tc1", acViewNormal, , , acFormAdd, acWindowNormal
Else
DoCmd.OpenForm "frm_tc1"

End If


End Sub

What am I missing? It is always prompting me to enter a new record, even if there is already one in the db.

Thanks,
Chuck

View Replies


ADVERTISEMENT

Dump Table Properties To A File

Feb 8, 2008

Is there a way to write the properties of a table out to a text file or excel sheet?

I'd like to be able to get the Field Name, Data Type, Field Size, and format for each field in my table.

Thanks,
CRhodus

View 3 Replies View Related

Programming Challenge/minor Brain Movement Anyone?

Mar 31, 2005

Hi,

Ok. So, here's the task

There are multiple employees on a table, each with a period of time for which they worked. I am trying to gather these times together to see how many complete records I have for the time period of 4/1/1999 to 12/31/2004. So, for example,

Employee 1 works from 4/1/1999 to 12/31/2000.

Employee 2 works from 1/1/2000 to 12/31/2004.

(From these two records, there will be 1 complete record of 4/1/99 to 12/31/04 AND 1 remaining record for the year 2000 left over.)

Employee 3 works from 1/1/2000 to 12/31/2004.

(From these three records, 1 complete record + 2 2000 + 1 each for the years 2000-2004.)

Employee 4 works from 1/1/2001 to 12/31/2003.

(= 1 complete + 2 2000 + 2 2001-2003 + 1 2004)

Employee 5 works from 4/1/1999 to 12/31/1999

(= 2 complete + 1 2000 + 1 2001-2003)

And this goes on for all the employees. I need to find out the end amount of how many complete records and remaining dates all the employees have worked. I hope this was at least, somewhat clear. I remember doing something similar to this ages ago in programming class, but since then, my mind has degraded. =P Any help, insights, or advice would be greatly appreciated on how to get this done. =)


G

View 5 Replies View Related

How Do I Inject/dump The Data From A Recordset Into An Existing Table Via VBA?

Nov 13, 2004

Say I have a table [tbl1] and a recordset [rst1].
The fields in both items are the same. Now, how do I copy/dump/inject (what's the correct term?) the data from the recordset into the table?

View 3 Replies View Related

Help Stamp Out Brain-Death: Cross-Tab To Make Table

Aug 28, 2006

Hi -

Desperately need a kick in the butt to restart the cognitive functions.

Am attempting to prepare a FY (1 Jul 05 - 30 Jun 06) rollup of services provided. Have done this for years with very little stress. Lost my notes in a melt-down and now it seems I'm lost.

Situation:

Properly normalized recap of various (about 15) services provided to clients over the one-year period. Created a cross-tab query that sums each of the services and displays columns for each service (represented by ServiceID, e.g. 2019, 2020, etc.)

The cross-tab works perfectly, just now need to turn it into a report. Try to use the Report Wizard, based on the cross-tab. Problem is, it returns no fields to select. Changed strategy and attempted to turn the cross-tab into a make-table query, which, I understand would return a spreadsheet-style table. For these purposes, that's exactly what I need and have examples going back 5 to 6 years how this worked wonderfully.

The cross-tab -> maketable works, but it reverts to the original normalized structure, which is not what is needed.

If someone can help to put me out of my misery, I offer my first-born as a small token.

Thanks,

Bob

View 3 Replies View Related

Newbie Normalization Question (or, "My Brain Hurts")

Aug 25, 2005

I would imagine that reading through someone else's normalization problems is as exciting as watching paint dry.

But I have seen some brilliant answers presented here so I'll give it a shot. I'll try to be brief and concise. I'm hoping someone can read through this and tell me if I'm on the right track.



I have a table full of employees. A few of these employees are supervisors. I was going to add a field called Supervisor to identify who each employee's supervisor is. I thought about just entering the Supervisor's SSN into that field. (SSN is the key field)

But every time a supervisor is promoted and replaced (quite often), every employee's Supervisor field would have to be edited. Sounds like I ought to create a seperate table with a list of supervisors, so I can replace the SSN just once.

I THINK this new table would have two fields, let's call them CrewCode and SupervisorSSN. So there might be, say, 15 employees in a particular supervisor's "crew", and all these employees' "CrewCode"s will point to their supervisor in this new table. When the supervisor is replaced, you just type in the new guy's SSN once.

Sound correct so far?

Here's where I am overcomplicating things for myself. I don't want it to be necessary for someone to arbitrarily create unique "CrewCode"s, because there are hundreds of Crews in this company but also because it feels wrong to do this arbitrarily when we already have data in other fields to uniquely identify the employee's crew.

Consider this:

The employee record has the following fields to identify which crew they work in. (I'll provide some possible values for these fields, to help put things into context.)

Region = {SE | E | NE}
Division= {Sawmill | Woodlands}
Site = {Atlanta | Charlotte | Axton | Foxboro}
Department = {Sawmill | Planermill | Treeplanting | Harvesting | Trucking | SupportStaff}
Crew = {1 | 2 | 3 | 4}

So if I string these values together, employee "John Smith" might work on a crew which is uniquely identified as:

SE.Woodlands.Atlanta.Treeplanting.2

No other crew in the company has that unique string of characters. (I would add the dots myself for readability.)

So my first question is, am I on the right track by trying to link employees with their supervisors using a table like:

SE.Woodlands.Atlanta.Treeplanting.2 593-88-6958
SE.Woodlands.Charlotte.Planermill.4 461-87-3772
NE.Sawmill.Foxboro.Sawmill.3 569-46-2674

That seems like a more elegant solution than arbitrarily assigning a CrewCodes of "00001", "00002", etc.


Second question: when the time comes to actually look up an employee's supervisor, the two tables would have to be JOINed in some manner. Is it possible (and advisable) to perform a JOIN using a collection of FIVE fields in the employee table? Or would I have to combine then into a new single field first, then JOIN on that field? I'd really like to avoid doing that.

Any help would be so very much appreciated!

View 2 Replies View Related

Queries :: Take Content Of Two Fields From One Table And Dump Into Other Table

Jun 27, 2013

I am trying to take the content of two fields from one table and dump them into the other table, I created an Append Query pulling up just the main table and appending to the destination table but it doesn't copy the info when I run it. I also pulled in both the tables (and yes they are joined) doing the same as above and still it doesn't do anything when I run it.

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved