473,498 Members | 1,809 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to select a row from a pop-up form for record import?

57 New Member
I am trying to import Excel files that contains names and stock id's. The format is something akin to this:

Stock Description -- Players
1991 Topps #145 -- Frank Thomas/Sammy Sosa/Cal Ripken

My 3 tables are
  • tblStockHeader with Stock_ID (auto#), Stock_Description
  • tblPlayerHeader with Player_ID (auto#), Player_Name, Player_DOB
  • tblStockPlayer with SPlayer_ID (auto#), Stock_ID (long), Player_ID (long)

My goal is to create lines in tables that will normaize the data involving the players as more than 1 can show up in the Excel file for the same Stock_ID. I've gotten that far with no problems so I'm more challenged by there might 2 players named the same thing (think 1960's Frank Thomas and 1990's Frank Thomas) and my Excel files won't know which is which.

So what I'm trying to do is when I import, VBA will dcount the # of Player_Names that match and if it's 0, it'll add the player to tblPlayerHeader and then add the player_id to tblStockPlayer, if it's 1, it'll just add the player_id to tblStockPlayer and if it's 2 or more, it'll open a form of potential matches for me to select which one to then add to the tblStockPlayer.

I truly don't know what direction to go in order to get the form of options to popup and then select/carry back to my original vba process the selected data.

Here is what I have. Please note that GetCSWord(strAString, I) is the broken-out Player_Name from the multiple potentials.

Expand|Select|Wrap|Line Numbers
  1.  
  2. For I = 1 To intCnt
  3.  
  4. searchcount = DCount("[Player]", "TestPlayerHeader", "[Player_Name] =""" & GetCSWord(strAString, I) & """")
  5.  
  6.     Select Case searchcount
  7.         Case 0
  8.             MsgBox "Need a new record"
  9.         Case 1
  10.             MsgBox "Only Record"
  11.         Case Is > 1
  12.             DoCmd.OpenForm "TestPlayerHeader", acFormDS, , "[Player_Name] =""" & GetCSWord(strAString, I) & """"
  13.     End Select
  14.  
  15.     Next
Jan 6 '11 #1
1 1342
HSXWillH
57 New Member
Repost: I've gone in a different direction and have some sample data that I'm not able to get DLOOKUP to work properly with.

My table, TestPlayerHeader has the fields of Player_ID (auto random #), Player (text) and DOB (date). Player and DOB are keys to limit unique records.

I have put some sample information in.

#### --- Edison --- 1/1/2000
#### --- Jones --- 1/1/2000
#### --- Jones --- 1/1/2001

My code to pull and find the Player_ID of the player + his DOB is as follows. I keep getting an Run-Time Error #6 -- Overflow error but there is not more than 1 record being pulled based on the conditions.

Expand|Select|Wrap|Line Numbers
  1. DoCmd.OpenForm "TestPlayerHeader", acFormDS, , "[Player] =""" & GetCSWord(strAString, I) & """"
  2. searchdob = InputBox("Enter a birth date.", "Birthdate Entry")
  3. searchid = DLookup("[Player_ID]", "TestPlayerHeader", "[Player] ='" & GetCSWord(strAString, I) & "' AND [DOB] =#" & searchdob & "#")
  4. MsgBox searchid
What coding am I doing wrong here? I want the unique Player_ID and there should be only an unique one based on the information I've entered.
Jan 13 '11 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

4
4664
by: Andre | last post by:
Hi guys, newbie question. I am having trouble with a script that is supposed to login me to my account on yahoo pop server. When i do this: import getpass, poplib, re POPHOST =...
6
23183
by: Will | last post by:
Hi, Sorry to be a pest... But I can figure this out. I'm pushing to a stack. then I need to check to see if the word is a palindrome. Is the code below correct? if so, how can I check the...
3
3014
by: Max Weber | last post by:
Try to run the code below in a page. You will notice than when you switch the multiple attribute of the SELECT tag, only one option is displayed as selected although multiple options have ben...
15
4123
by: Stig Brautaset | last post by:
Hi group, I'm playing with a little generic linked list/stack library, and have a little problem with the interface of the pop() function. If I used a struct like this it would be simple: ...
10
2781
by: Martin Holm Pedersen | last post by:
Hey All.. Im having a bit of a problem with my program that i wrote for linux in c. I use select() to monitor if the user has pressed a key and reads the key with read(). It works fine om my IBM...
25
4171
by: Nicholas Parsons | last post by:
Howdy Folks, I was just playing around in IDLE at the interactive prompt and typed in dir({}) for the fun of it. I was quite surprised to see a pop method defined there. I mean is that a...
10
2232
by: mjpdatadev | last post by:
I am relatively new to XMLRequest, DOM and Ajax but I really like the functionality. I have the DIV and SPAN changes working well but I thought that I would experiment with changing the actual...
7
24920
by: Scott | last post by:
As said before I'm new to programming, and I need in depth explaination to understand everything the way I want to know it, call it a personality quirk ;p. With pop() you remove the last element...
1
4317
by: Mikle | last post by:
I need to update values in a table (where they are null or zero) with values from another table for the corresponding PopulationMemberID. Now I now that you can't update where there is a join.....
1
1002
by: abhishekbrave | last post by:
I want to create a menu in left pannel of HTML page. Each menu item will have different sub menu items. My requirement is that whne a user select or click on a menu item the sub menu items should...
0
7005
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7168
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
6891
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7381
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5465
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4916
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4595
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3087
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
293
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.