473,386 Members | 1,748 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Coding Drop down box to copy information

8
Hello every one, Im attempting to creat a database for a non profit veteran org. The data base is going to be used in a call center, where they take the callers information and the veterans information. However some times the caller is the veteran. I have a drop down list with values of "veteran;loved one" if veteran is selected i am trying to have the name values from the caller section on the form copied down to the veterans info section. All this is taking place on one form then when submited is entered into the database. any suggustions? i have very limited programming background so breaking it down "barney style" would be greatly appriciated. Thanks for the help and keep up the great work.
Jun 12 '10 #1

✓ answered by MMcCarthy

I think the simplest method for you would be to code in the AfterUpdate event of the dropdown box. Lets assume the dropdown box is called combo1, you will need to code something like the following ...

Expand|Select|Wrap|Line Numbers
  1. Private Sub combo1_AfterUpdate()
  2.  
  3.     If Me.combo1 = "Veteran" Then
  4.         'I'm guessing field names here
  5.         Me.VeteranName = Me.CallerName
  6.         Me.VeteranAddress1 = Me.CallerAddress1
  7.         ' and so on
  8.     End If
  9.  
  10. End Sub

11 1555
MMcCarthy
14,534 Expert Mod 8TB
I think the simplest method for you would be to code in the AfterUpdate event of the dropdown box. Lets assume the dropdown box is called combo1, you will need to code something like the following ...

Expand|Select|Wrap|Line Numbers
  1. Private Sub combo1_AfterUpdate()
  2.  
  3.     If Me.combo1 = "Veteran" Then
  4.         'I'm guessing field names here
  5.         Me.VeteranName = Me.CallerName
  6.         Me.VeteranAddress1 = Me.CallerAddress1
  7.         ' and so on
  8.     End If
  9.  
  10. End Sub
Jun 12 '10 #2
VVSD
8
Awesome, thank you so much for your help. i got it figured out, I'm sure ill be back soon with more questions. Thanks again have a great weekend.

VR,
Mike
Jun 12 '10 #3
VVSD
8
@msquared
sorry I am back. so what command could i use to leave the veteran fields empty if loved one is selected in the combo? thanks :)
Jun 12 '10 #4
MMcCarthy
14,534 Expert Mod 8TB
@VVSD
In the example I gave you the veteran fields should only be filled if the dropdown box is set to Veteran so nothing should happen if anything else is selected.
Jun 12 '10 #5
VVSD
8
@msquared
I understand that, but I am talking about the possibility that it is seleceted, and it updates the veterans fields with the caller info, then is changed to loved one. I want it to clear the fields if loved one is selected so I used the code:

Expand|Select|Wrap|Line Numbers
  1. Private Sub Combo58_LostFocus()
  2.    If Me.Combo58 = "Veteran" Then
  3.        Me.firstname = Me.ContactFirstName
  4.        Me.lastname = Me.ContactLastName
  5.        Me.Veteransgender = Me.CallersGender
  6.         Me.veteransage = Me.callersage
  7.     Else: Me.Combo58 = "loved one"
  8.     Me.firstname = " "
  9.        Me.lastname = " "
  10.        Me.Veteransgender = " "
  11.         Me.veteransage = " "   
  12.  
  13.   End If
  14. End Sub

Do you think i will have any problems with this? thanks
Jun 12 '10 #6
MMcCarthy
14,534 Expert Mod 8TB
@VVSD
Sorry I misunderstood your question. The code you have posted looks fine. Is it giving you any problems?
Jun 12 '10 #7
VVSD
8
@msquared
No problems that I can find yet. My mistake, I didnt explain the situation very well. thanks for your help. :)
Jun 12 '10 #8
VVSD
8
@VVSD
Ok one more question for the day, I have the following code

Expand|Select|Wrap|Line Numbers
  1. Private Sub Submit_Click()
  2. On Error GoTo Err_Submit_Click
  3.     DoCmd.GoToRecord , , acNewRec
  4. Exit_Submit_Click:
  5.     Exit Sub
  6. Err_Submit_Click:
  7.     MsgBox Err.Description
  8.     Resume Exit_Submit_Click    
  9.     DoCmd.Close acForm, Me.Name, acSavePrompt    
  10. End Sub
for my submit button on my client intake form. I am trying to make the submit button create a new client, then open a new form called openclients with the clients information that was just entered. any idea?
Jun 13 '10 #9
MMcCarthy
14,534 Expert Mod 8TB
@VVSD
Not quite sure I know what you mean. This code just goes to the "New Record" for a form. What form is this on as opposed to what form are you then trying to open? And what is the record source for both forms?
Jun 13 '10 #10
VVSD
8
@msquared
i have a table named clients, which stores all the clients information. The current form is called clients, after entering their information i hit submit, and it enters the data from the form into the table. I want it to also open up a new form named "open clients" with the information i just entered
Jun 13 '10 #11
MMcCarthy
14,534 Expert Mod 8TB
@VVSD
Is the ClientID an automated number field?

If so you could do something like this ...

Expand|Select|Wrap|Line Numbers
  1. Option Compare Database
  2. Option Explicit
  3.  
  4. Dim clientNum As Long
  5.  
  6.  
  7. Private Sub Submit_Click()
  8. On Error GoTo Err_Submit_Click
  9.  
  10.     DoCmd.GoToRecord , , acNewRec
  11.     clientNum = Me.ClientID
  12.  
  13. Exit_Submit_Click:
  14.     Exit Sub
  15. Err_Submit_Click:
  16.     MsgBox Err.Description
  17.     Resume Exit_Submit_Click
  18.     DoCmd.Close acForm, Me.Name, acSavePrompt
  19. End Sub
  20.  
  21. Private Sub Form_Close()
  22.  
  23.     DoCmd.OpenForm "Open Clients", acNormal, , "[ClientID]=" & clientNum
  24.  
  25. End Sub
I've used the form close event to trigger the opening of the other form but you can change that to some other event if you feel its better.
Jun 13 '10 #12

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

Similar topics

5
by: Vigneshwar Pilli via DotNetMonster.com | last post by:
string connectionString1 = "server=(local); user=sa;password=sa; database=sonic"; System.Data.SqlClient.SqlConnection dbConnection1 = new System.Data.SqlClient.SqlConnection(connectionString1);...
2
by: Ren | last post by:
Hi all, I am a bit new to PHP and SQL so this may seem like a dumb question. I have already created a drop down list as part of a form which is automatically populated with values taken from a...
7
by: callawayglfr | last post by:
I am building a database in access where I have a drop down box that relates to a text box, that part I have working but when someone selects information from the first drop down I need it to limit...
5
by: Ajith Menon | last post by:
I need to select multiple entries in the drop down list. E.g. Search a string in languages like C#, VB, Java etc. These entries are in drop down. So i need to multi select to search in multiple...
4
by: TycoonUK | last post by:
Hi, As I do not have IE7 on my computer, I was wondering if there is a fault in my CSS Menu when using IE7. Please can someone look at my site - http://www.worldofmonopoly.co.uk and tell me...
0
by: mjohnson0321 | last post by:
I am trying to incorporate a CSS drop-down menu into a site (suckerfish menu). The menu gets lost behind the content below it, but only on one of the drop downs (News). The error occurs on all of...
2
by: phpnewbie26 | last post by:
I currently have two drop down menus where the second one is populated from the first one. My second drop down menu should be able to do multiple selection. I have searched online and found out how...
6
by: Palehorse | last post by:
I'd like to apologize upfront for me saying "I'm not a programer", I'm sure you all hear this a hundred times a day. Unfortunately, in this case, it's true. I've been working on trying to figure out...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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
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,...

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.