Adding a Record

I have 2 Subforms on my Main form.  

Each Subform contains a combo box with drop-down list.  Their tables are on 
the many side of the one-to-many relationship with the Main form.

When I make a selection on Subform 1, Subform 2 automatically populates with 
a correlated item from its drop-down list.

PROBLEM:  when I make a SECOND selection on Subform 1, the item that was 
listed on Subform 2 gets replaced with the item correlating with the SECOND 
selection.

How can I adjust my code so that the second item is ADDED to the list on 
Subform 2 instead of replacing the first item?

A sample of the code to automatically populate Subform 2:

    If InStr(1, Me.Combo1.Value, "Spreadsheet") > 0 Then
        Me.Parent![Application].Form.Combo2.Value = "Excel"
    End If

Thanks!


0
Utf
4/27/2007 6:50:05 PM
access.formscoding 7493 articles. 0 followers. Follow

3 Replies
417 Views

Similar Articles

[PageSpeed] 54

Hi Rosemary,

how about something like this:

with Me.Parent![Application].Form
    if not .NewRecord then
       .Recordset.AddNew
       .Combo2 = "Excel"
    end if
end with


Warm Regards,
Crystal
  *
      (:  have an awesome day  :)
   *
MVP Access
Remote Programming and Training
strive4peace2006 at yahoo.com
   *



Rosemary wrote:
> I have 2 Subforms on my Main form.  
> 
> Each Subform contains a combo box with drop-down list.  Their tables are on 
> the many side of the one-to-many relationship with the Main form.
> 
> When I make a selection on Subform 1, Subform 2 automatically populates with 
> a correlated item from its drop-down list.
> 
> PROBLEM:  when I make a SECOND selection on Subform 1, the item that was 
> listed on Subform 2 gets replaced with the item correlating with the SECOND 
> selection.
> 
> How can I adjust my code so that the second item is ADDED to the list on 
> Subform 2 instead of replacing the first item?
> 
> A sample of the code to automatically populate Subform 2:
> 
>     If InStr(1, Me.Combo1.Value, "Spreadsheet") > 0 Then
>         Me.Parent![Application].Form.Combo2.Value = "Excel"
>     End If
> 
> Thanks!
> 
> 
0
strive4peace
4/28/2007 8:54:30 AM
Hi Crystal,

Thanks!  Another question, please:

Here is what my code looks like (the example I provided before was 
abbreviated).  I just ran it, and, while I didn't get any error message, 
nothing actually happened.  That is, new records were not created and the 
items "Website" and "Overnight Delivery" did not appear.  (I tried the code 
without the .Value and with the .Value).

What am I doing wrong?

Thanks again!
Rosemary

If InStr(1, Me.Combo92.Value, "FedEx Overnight Delivery") > 0 Then
   
    With Me.Parent![sfrmApplication].Form
        If Not .NewRecord Then
            .Recordset.AddNew
            .AppName.Value = "Website"
        End If
    End With
   
    With Me.Parent![Finish].Form
        If Not .NewRecord Then
            .Recordset.AddNew
            .Combo202.Value = "Overnight Delivery"
        End If
    End With
   
    Me.Parent.Form.Title.Value = _
        Me.Parent.Form.Title.Value & "FedEx Overnight Delivery"
   
    Me.Parent.Form.DocNums.Value = _
        Me.Parent.Form.DocNums.Value & "FedEx Overnight Delivery"
   
    Me.Parent.Form.PageCount.Value = _
        Me.Parent.Form.PageCount.Value & "0"

End If



"strive4peace" wrote:

> Hi Rosemary,
> 
> how about something like this:
> 
> with Me.Parent![Application].Form
>     if not .NewRecord then
>        .Recordset.AddNew
>        .Combo2 = "Excel"
>     end if
> end with
> 
> 
> Warm Regards,
> Crystal
>   *
>       (:  have an awesome day  :)
>    *
> MVP Access
> Remote Programming and Training
> strive4peace2006 at yahoo.com
>    *
> 
> 
> 
> Rosemary wrote:
> > I have 2 Subforms on my Main form.  
> > 
> > Each Subform contains a combo box with drop-down list.  Their tables are on 
> > the many side of the one-to-many relationship with the Main form.
> > 
> > When I make a selection on Subform 1, Subform 2 automatically populates with 
> > a correlated item from its drop-down list.
> > 
> > PROBLEM:  when I make a SECOND selection on Subform 1, the item that was 
> > listed on Subform 2 gets replaced with the item correlating with the SECOND 
> > selection.
> > 
> > How can I adjust my code so that the second item is ADDED to the list on 
> > Subform 2 instead of replacing the first item?
> > 
> > A sample of the code to automatically populate Subform 2:
> > 
> >     If InStr(1, Me.Combo1.Value, "Spreadsheet") > 0 Then
> >         Me.Parent![Application].Form.Combo2.Value = "Excel"
> >     End If
> > 
> > Thanks!
> > 
> > 
> 
0
Utf
4/28/2007 1:02:01 PM
Hi Rosemary,

you're welcome ;)

when you use the Parent property, you do not need Form after it

change
Me.Parent.Form.Title.Value

to simply
Me.Parent.Title.Value

Warm Regards,
Crystal
  *
      (:  have an awesome day  :)
   *
MVP Access
Remote Programming and Training
strive4peace2006 at yahoo.com
   *



Rosemary wrote:
> Hi Crystal,
> 
> Thanks!  Another question, please:
> 
> Here is what my code looks like (the example I provided before was 
> abbreviated).  I just ran it, and, while I didn't get any error message, 
> nothing actually happened.  That is, new records were not created and the 
> items "Website" and "Overnight Delivery" did not appear.  (I tried the code 
> without the .Value and with the .Value).
> 
> What am I doing wrong?
> 
> Thanks again!
> Rosemary
> 
> If InStr(1, Me.Combo92.Value, "FedEx Overnight Delivery") > 0 Then
>    
>     With Me.Parent![sfrmApplication].Form
>         If Not .NewRecord Then
>             .Recordset.AddNew
>             .AppName.Value = "Website"
>         End If
>     End With
>    
>     With Me.Parent![Finish].Form
>         If Not .NewRecord Then
>             .Recordset.AddNew
>             .Combo202.Value = "Overnight Delivery"
>         End If
>     End With
>    
>     Me.Parent.Form.Title.Value = _
>         Me.Parent.Form.Title.Value & "FedEx Overnight Delivery"
>    
>     Me.Parent.Form.DocNums.Value = _
>         Me.Parent.Form.DocNums.Value & "FedEx Overnight Delivery"
>    
>     Me.Parent.Form.PageCount.Value = _
>         Me.Parent.Form.PageCount.Value & "0"
> 
> End If
> 
> 
> 
> "strive4peace" wrote:
> 
>> Hi Rosemary,
>>
>> how about something like this:
>>
>> with Me.Parent![Application].Form
>>     if not .NewRecord then
>>        .Recordset.AddNew
>>        .Combo2 = "Excel"
>>     end if
>> end with
>>
>>
>> Warm Regards,
>> Crystal
>>   *
>>       (:  have an awesome day  :)
>>    *
>> MVP Access
>> Remote Programming and Training
>> strive4peace2006 at yahoo.com
>>    *
>>
>>
>>
>> Rosemary wrote:
>>> I have 2 Subforms on my Main form.  
>>>
>>> Each Subform contains a combo box with drop-down list.  Their tables are on 
>>> the many side of the one-to-many relationship with the Main form.
>>>
>>> When I make a selection on Subform 1, Subform 2 automatically populates with 
>>> a correlated item from its drop-down list.
>>>
>>> PROBLEM:  when I make a SECOND selection on Subform 1, the item that was 
>>> listed on Subform 2 gets replaced with the item correlating with the SECOND 
>>> selection.
>>>
>>> How can I adjust my code so that the second item is ADDED to the list on 
>>> Subform 2 instead of replacing the first item?
>>>
>>> A sample of the code to automatically populate Subform 2:
>>>
>>>     If InStr(1, Me.Combo1.Value, "Spreadsheet") > 0 Then
>>>         Me.Parent![Application].Form.Combo2.Value = "Excel"
>>>     End If
>>>
>>> Thanks!
>>>
>>>
0
strive4peace
4/28/2007 5:16:21 PM
Reply:

Similar Artilces:

Merge records function
Is it possible to reuse the record merge function in CRM. Fx to call the function with a valid Account GUID with a URL-call to mergerecords ? I want this to open the merge windows with the GUID as the master record. ...

-1026 JET_errRecordTooBig, Record larger than maximum size
I administer a single Windows 2003 domain, Native Mode only W3k servers and use Exchange 2003. I am seeing this error in all DC Directory Service Event Logs. Event Type: Error Event Source: NTDS SDPROP Event Category: Internal Processing Event ID: 2008 Date: 28/07/2004 Time: 6:38:04 PM User: NT AUTHORITY\ANONYMOUS LOGON Computer: TLSAD1 Description: Internal error: The security descriptor propagation task encountered an error while processing the following object. The propagation of security descriptors may not be possible until the problem is corrected. Object: CN=internal 29176...

Adding stages to a Sales Process
Hi, I want to add two new stages to a current sales process. Has anyone done this before? Any issues arise with previous opportunties, reporting, etc? Thanks, Sinead. -- Sinead O''''Shaughnessy previous opportunities will not see the new stages ============================== John O'Donnell Microsoft CRM MVP http://www.crowecrm.com "Sinead" <Sinead@discussions.microsoft.com> wrote in message news:8EC75D1E-06C5-4A6E-813D-1B5816DE87B6@microsoft.com... > Hi, > I want to add two new stages to a current sales process. Has anyone done > this bef...

Previous Record
How do I access a field from the previous record in a form To programmatically read the value from the previous record, regardless of how the form is sorted or filtered, use the RecordsetClone of the form. This kind of thing: Function GetPreviousValue(frm As Form, strField As String) As Variant On Error GoTo Err_Handler 'Purpose: Return the value from the previous row of the form. 'Keywords: PriorRow PreviousValue Dim rs As DAO.Recordset Set rs = frm.RecordsetClone rs.Bookmark = frm.Bookmark rs.MovePrevious GetPreviousValue = rs(strField) Set rs...

How to have one year value added to another cell
I have a cell where I date foramtted fill in the date. How to have on another cell the date + one year automatically filled? So, A1 02-04-06 auto: B1 02-04-07 Bart Excel 2003 =DATE(YEAR(A1)+1,MONTH(A1),DAY(A1)) Bob Umlas Excel MVP "AA Arens" <bartvandongen@gmail.com> wrote in message news:1164983094.802613.212520@l12g2000cwl.googlegroups.com... > I have a cell where I date foramtted fill in the date. > How to have on another cell the date + one year automatically filled? > > So, > > A1 02-04-06 > > auto: > B1 02-04-07 > > > Bart >...

Adding sums in rows and columns and colouring cells with conditions
Hi all, I have a long table where i need to add and colour individual cells based on 'days home' and 'days away'. The table is uploaded here https://www.yousendit.com/download/MnFqaUNBUzhoMlYzZUE9PQ In order to automate some of this i'd like to automate some, but preferably all aspects of this, such as: 1. automatically colour the cell orange for "home" and yellow for "away" 2. add separately in the home and away columns the number of days for each 3. add the rows for the alternate lines (ie days only, rates only) I want to do this without yet another...

substraction of sequential records
I need to calculate moving ranges in either a report or query. Currently my query returns TestTime (ascending) and TestResult. The moving range is the absolute difference between two consecutive samples. TestTime TestResult MovingRange 8am 20 -- 9am 24 4 10am 21 3 11am 26 5 Once all the moving ranges are calculated, I need to report the average of the moving ranges. ...

Advance filter not filtering unique records only
Hi, I have a user who has four large lists, he wants to combine them into two master lists; but hide or delete duplicates. I showed him how to use Advance Filter and he said it worked perfectly for combination; but the second worksheet did not filter only unique records. He assured me he followed the directions and click "Unique Records" in the Advance filter dialog box; but it didn't work. Can you guys give me a few more avenues he can pursue: (I suggested misspelled entries, and double-checking his work.) Thanks Kim I agree with you. My bet is that there is a typo or even ...

Field with running count of records
Hi, I have a query with fields such as date, Item Number and Quantity. I want to create an additional field called Count that will act like an autonumber. It will assign a value of 1 for the first record, 2 for the second number etc. Can someone tell me how to do this? Thanks, -- Chuck W There are tons of posts on how to create a "ranking" query. You must have a field or fields that uniquely identify the sort order. If you provided significant table and field names as well as your desired sort order, someone could create the SQL for you if you can't search for and fi...

Adding text and date problem
I have text in column 1, a date in column 2 and in column 3 I wish to show the text followed by the date. I have tried both Concatenate and & but the the result is text followed by the underlying number representing the date. I cannot seem to format this column to show the date as dd/mm/yy. Any suggestions? Regards ="Today is: "&TEXT(A1,"mm/dd/yyyy") -- Kind regards, Niek Otten Microsoft MVP - Excel "newman" <aa111@despammed.com> wrote in message news:464C1646.AC6A42E0@despammed.com... |I have text in column 1, a date in column 2 and in column...

adding values of cells
I am trying to use a formula or function that will look at a cells say column A check for a condition, if true, then add the value of another cell that is on the same row to another cell. Yes I know that may be difficult to understand so let me give you an example. A B C D 1 2 dvd 25.23 3 cd 12.25 4 dvd 25.23 5 cd 12.25 6 bat 19.25 ok so what i want to do is look at column A, and look for any cells that have dvd and add the corresponding value from column D to cell B1. So in this case we can see the cell A2 and cell A4 is dvd so I want to add cells D2 and D4 and that...

Adding and subtracting from a column.
I have a stock list with a "quantity" column. What I would like to do is add the new stock to the existing quantity column or subtract requisitioned items from the quantity column. I guess it is a "self totaling" column I need to make. As a separate exercise I would like to make a new column for orders. Insert a quantity on that column for any of the items ( rows) I want to order and then print it out... BUT I only want to print the rows that have quantities in that column ( i.e. the actual items I am ordering ). This column is not linked to the above column. Could an...

Adding items (hours) into invoices
Hello, In my M07 Home and Business, I get an error while entering an invoice as soon as I add hours and press enter. The program says that there's an error: "This operation can not be performed" When I select more help, I get a help page that say:Details Id: obres:34 Bron: 16.0 When I search on this I see that it is an error that's related to homepage settings, but that does not work for me. Any suggestions? Thanks, Eric ...

email account will not show up when added: says deleted
my main email account will not show up in the "accounts" section of Outlook 2003 even though I have added it and the "test" button shows it is set up correctly. It is listed in the accounts pane of add/change email accounts but when I try to set it as the default account I get a message it is not found and probably was deleted. I have deleted and re added it several times with the same result. Any solution ? Alec McNaughton <anonymous@discussions.microsoft.com> wrote: > my main email account will not show up in the "accounts" > section of Outl...

Default Public View has records but columns are blank
A custom entity has a default list view but the entries in the list do not show any values. There are a number of lines in the list with an icon only. If I try to delete one the message says select an entry before attempting operation. I cannot select the lijne either. Have created many views before and never seen this. Other views are ok? Hi Steve, Try publishing the entity and see if this resolves the problem. HTH, Niths "Steve" wrote: > A custom entity has a default list view but the entries in the list do not > show any values. There are a number of lines in the...

synchronized combo boxes moving between records problem
Sorry if this has been answered, I couldn't find the exact problem elsewhere! I'm only a beginner at this but when i select the right ID from the first combo box, i got it to come up with the correct related IDs in the second combo box , like it's meant to! but when I move to the next record (a new one, or the last one, or anything), the second combo box doesn't retain the record. As in, as you scroll through each record, none of the second combo box 'records' are kept, they are all blank until you click on them, then they come up with your choices, UNLESS you ...

Adding 2nd Y-axis to Excel2003 chart
I am making a simple line chart with two types of column data. I want to represent them with separate Y-axes. However, when I select the two columns of data and go through the Chart wizard the secondary Y-axis option is inaccessible. Excel 2003 help is no help as it tells me to go to the Format Menu, click Selected Data Series then click the Axis tab, but there is no such option under my format menu. How do I select the secondary Y-axis option? Hi, The chart wizard does not give you the option to place the selected data on 2 axes. You will have to do it once the chart is cre...

Access Denied error while edit some of the GPOs in Windows 2003 AD
Hi We are unable to edit some of the GPOs (Default Domain Policy, etc) and getting Access Denied error. We checked the permission of SYSVOL folder and found Administrators (Domain), System and Authenticated Users have full control share permissions. Full access has been provided to Administrators, creator owner & System and read & execute permission has been provided to Authenticated users in Security tab. Can anyone help me to resolve the issue and also any doc is available to check the correct permissions with SYSVOL. Thanks in advance for help Regards Lal -...

My code stops after the record saves....form never closes
Users are going into to update a number, and they want to close the form before the record gets saved, thus losing their changes. I created an Exit button, which should save the record change and close the form. Here's the code: If Me.Dirty Then RunCommand acCmdSaveRecord End If Forms![frmRMSHours]![Act Hours] = Me![Text9] DoCmd.Close If the record is dirty, they press Exit and the record saves. They have to press Exit again and the form closes. If the record is not dirty, the form will close when pressing Exit. What am I doing wrong? To save ...

Adding a password to a reminder?
This is a family PC which several of us use. Outlook 2002, XP ProSP2. There have been a couple of occasions when one of us have set a reminder in Calendar, but it has popped up when another user is at the machine. Teenagers being what they are, they don't appreciate the importance to someone else, and its been 'dismissed'. The Mum misses a deadline cos no-one reminded her.... I realise the answer to this lies in our helping one another out - and I'm creasonably confident that will happen - but I wonder if as a failsafe I can prevent an item being dismissed in some way...

adding second y axix
I have a chart that looks like this Dates (should be in the Y axis) number ( 1,2 ,3 ect) in the x axis cost (should be the second y axis) using Excel 2002 - Scatter Chart - can this be done -- Message posted from http://www.ExcelForum.com HELP!!! Any one?? -- Message posted from http://www.ExcelForum.com Put Numbers in col A Dates in B Cost in C Select A1:C20 (or what ever); make chart Right click the Cost line in chart, open Format Data Series and look for Secondary Axis best wishes Bernard "mmick >" <<mmick.1cog6h@excelforum-nospam.com> wrote in message news...

adding sales history
I have started working with qsrules in the vb.net enviroment. I am trying to load sales history from another pos system. I found this code on this site and started working with it. It seems to write to the batch tbl but can not seem to get it to work on the transaction tbls. How do i go about tendering this? what is missing? thanks Dim sess As New QSRules.SessionClass Dim cnn As New QSRules.ConnectionInfoClass cnn.RegisterNumber = 1 cnn.Provider = "SQLOLEDB.1" cnn.UserID = "uid" cnn.Password = "pwd" cnn...

Populate multiple records via check boxes
I've read through some of the posts here and found similar situations with solutions but I just can't quite understand how to do this. I am trying to use form controls i.e. checkboxes and/or multiselect list boxes to populate multiple records from a related table. I have 3 tables: teachers, subjects, & subjects_to_teachers. In the table "teachers_to_subjects" each record contains one teacher & one subject. The purpose of this table is to relate teachers to subjects in a many-to-many fashion. I have a primary form which shows teacher info. What I want is a form...

Installation Problem
I am installing CRM on a SBS 2003 system. I have been careful, so am surprised to have the following problem. I am at "Add a License Key" on page 139 of Implementation Guide. When starting the Deployment manager, I get "Snap- in failed to initalize". Any ideas?? The only part of the installation so far that might have tricked me was the adding of members to the Pre-Windows 2000 Compatible Access Group (page 138). I could not add the server name (MMSBSSERVER) or "localsystem", so I added "Local Service" as a member. Ken; usually when you get ...

automatic component added to palette
Hi, On computer 'A' I've create a userform in Excel that need additional components than what are installed by default. Till i use my form on the computer 'A', there is not problem, all components are visible. If i open this excel file on computer 'B', the additional components are not displayed on my userform because they are not added to my component palette. Is there an automatic way how to install the additional component on this component palette ? for example, i use a progress bar from MS, or a rich text Box... I do not want to make user to add them m...