inserting a new record from a pop-up, and returning to the main form at that record.

I have some code that reads:
go to next record,
if the next record is a new record,
based on the value of the previous record, assign a specific value to a 
particular field OR open a modal form that offers some choices for the value 
to be assigned

in both cases, if the new value is "X" , assign the new value to that 
record, and then add another new record with a value of "X+1" assign to the 
field (and go tot hat record for edits)

I have no problem doing this when I am in the first situation (not needing 
to open the second form), but from the second form, I am lost

here's some snippets of the code:
on the main form "frmSpec":

   With frm
       If IsNumeric(Right(strInitial, 1)) Then
            stDocName = "frmNextFixtureTypeOption"
            DoCmd.OpenForm stDocName, , , stLinkCriteria ', , acDialog, 
            With Forms![frmNextFixtureTypeOption]
                .[lblInitialAlpha].Caption = strInitialAlpha
                .[lblNextAlpha].Caption = strNextAlpha
                .[lblNextNumeric].Caption = strNextNumeric
            End With
            .txtType = strNextAlpha
            'if next type is an "o" or  "x" then add as not used type and 
advance to next type
            If Ucase(Right(strNextAlpha, 1)) = "O" Or 
Ucase(Right(strNextAlpha, 1)) = "X" Then
                .basedescription = "NOT USED"
                strNextAlpha = Mid(strNextAlpha, 1, Len(strNextAlpha) - 1) & 
Chr(Asc(Right(strNextAlpha, 1)) + 1)
                DoCmd.GoToRecord , , acNext
                .txtType = strNextAlpha
            End If
        End If
    End With

and behind the pop-up form "frmNextFixtureTypeOption"

Private Sub cmdNextAlpha_Click()
    Forms![frmSpec].txtType = Me.lblNextAlpha.Caption

' this is where I need to add code to check the value of 
Forms![frmSpec].txtType, and potentially add the second record

 End Sub

any suggestions would be greatly appreciated,
many thanks in advance,

4/3/2010 3:56:03 PM
access.formscoding 7493 articles. 0 followers. Follow

0 Replies

Similar Articles

[PageSpeed] 10


Similar Artilces:

referencing to worksheet names in macro for each new worksheet inserted
Hi I created a code to insert new worksheets and rename them according t values on the new worksheet itself. Say in Cell D1, i have th worksheet name. My question is when i want to refer to this worksheet in subsequen coding, how should i code it? For eg, How should i write the ???? for Sheets("????").select? Would creatin the a variable to store the names help? Thanks in advance Ken -- Message posted from After inserting your new worksheet set it's name equal to a variable. For example SHEETS.ADD VWORKSHEET = ACTIVESHEET.NAME This method ...

Publisher Pic Problems & VGA Driver
Hi, I'm very frustrated. I too cannot see any embedded photos when I open up my Publisher doc for editing. Tried everything in Help & now have read everything in the Online Support. (Btw, I'm not absolutely positive but I think this "invisible pics" problem started happening after I downloaded Flash 8, as a last resort I will uninstall it). Anyway, I have an Asus W5A laptop with Windows XP Pro. It has Intel Centrino Mobile which includes an Intel (R) 915/GM Chipset driver. So following suggestions on this site, I went to the Intel to find driver downloads to upd...

Updating a table from Form Entry
I have a form that pops up when a user clicks a button to Print said form. The form is for the user to enter the name of the table and any footnotes for that particular form, this form is connected to a table that stores this information for everytime the report is printed. THe problem I having is that when the user enters the information and clicks [PRINT] the report is blank, when I open the table the info the user has entered has not updated onto the table yet. Is there a way so that when the user clicks [PRINT] the footnote table will update BEFORE the report prints? Larry -- Neve...

Update textbox on form
The following are events on two combo boxes on a subform "NewJobsSubform", the first sets the rowsource of the second and also sets a default value in the second. The second event sets the value in the text box "Sell" to the price associated with the RepProduct in cboRepProduct - collected from the table "RepairProducts". "Private Sub cboCatName_AfterUpdate() On Error Resume Next Me.cboRepProduct.RowSource = "SELECT RepairProduct.RepProduct FROM" & _ " RepairProduct WHERE CatName = '" & Me.cboCatName.Value...

INSERT INTO problems
Hi all, I hope this doesn't appear twice, I did it a while ago and it never came up! So here goes again! I am trying to use INSERT INTO to insert one record in to a table (tna feedback) in two fields (USER ID: and DESK/LAPTOP). The values are generated by two different forms; stUser comes from this form and stMachine comes from another form which has been hidden once the user has chosen the value. This part works fine. However, every time I run it I get an "Incomplete Query clause" error message but can't fidure out what I've done wrong! Here is the code: Dim SQL ...

Forms Based Authentication
I have configured Exchange 2003 Server on Windows 2003 Server. Everything works , HTTP,HTTPS, OWA Password change , but whenever I enable forms based authentication I recieve an error "440 login timeout" and the page will not load. Pls Help Regards I hesitate, because it doesn't fully match your diagnosis but take a look at:;en- us;817379 to see if it's of any help. >-----Original Message----- >I have configured Exchange 2003 Server on Windows 2003 Server. Everything >works , HTTP,HTTPS, OWA Password change ,...

Where Can I Find The Icon For A New E-mail Message In Outlook?
I've created the shortcut "C:\Program Files\Microsoft Office\OFFICE11\OUTLOOK.EXE" /c ipm.note for my Outlook to open a new message but it assigns the Outlook Icon... Thanks Assuming you are using an English version Outlook 2003, you might find what you are looking for at: \Program Files\Microsoft Office\OFFICE11\FORMS\1033 "Justern" <> wrote in message news:4133cc19$0$27218$ > I've created the shortcut "C:\Program Files\Microsoft > Office\OFFICE11\OUTLOOK.EXE" /c ipm.note for m...

How Do I Copy My Outlook Files To My New Computer?
I exported my Outlook files from my old computer and burned them to a CD. During the export process, it asked me three times for a password. When I tried to import these files to my new computer I got "File access is denied. You do not have the permission required to access the file." Can anyone help? Apart from the fact that Import/Export options often lead to corruption - you should use a simple pst copy - The pst needs to be on the hd and the read only flag off, before In OL attempting to open it. NB not import <> wrote in message news:1145746658.84...

View in new Portfolio Manager
Older portfolio manager had a view available which displayed by type of security. I am unable to find this option in the new portfolio manager. Am I missing something? Charlie On May 22, 9:57=A0pm, charlie <> wrote: > Older portfolio manager had a view available which displayed by type of > security. =A0I am unable to find this option in the new portfolio manager= .. =A0Am > I missing something? > Charlie You didn't state which version of Money you are using but I'll attempt to answer. If you are using Money Plus, you can choos...

Automatically redirecting profiles to a new exchange server?
OK old exchange server was SERVEROLD and new one is SERVERNEW (for arguments sake). The pc has lots of different profiles on it and I dont wanna manually change each profile to reflect the new server. Running Outlook 2002 is there a way to automatically do this? I believe I can use a prf file created using Custom Wizards from the Office Resource Kit and deploy this to do this for me. Can anyone give any more detailed info on how this can be done? Thanks <> wrote in message > OK ol...

Please help with last formula for order form.
I am able to accomplish this with 1 column by the formulas below. Cell H160 is the subtotal: =IF(SUM(H72:H111)>0,SUM(H72:H111),"") Cell H166 the total: =IF(SUM(H160)>0,SUM((H160*H163)+H160),"") Cell H163 is for Tax. I am almost finished creating an order form. I would like to get the SUM of 3 different columns that are separated. I am not able auto fill strait down the column, because the information is separated in groups with titles, and the cells are not identically sized. I tried varations of this formula: =IF(SUM(H72:H111)+(116:131)+(135:154)>0,SUM ((H72:H...

Automatically generate a new record
Can I autumatically generate a new record adding information (future date) from a current record? Yes. In your form have Double-click event call an append query that pull data from your form fields to append one record. INSERT INTO [YourTableToAppendInto] ( Field1, Field2, Field3, Field4 ) SELECT TOP 1 [Forms]![YourForm]![1stField] AS [X], [Forms]![YourForm]![2ndtField] AS [Y], [Forms]![YourForm]![2rdtField] AS [Z], [Forms]![YourForm]![4thtField] AS [A]; -- KARL DEWEY Build a little - Test a little "Crown Jenny" wrote: > Can I autumatically generate a new record addin...

Update Existing Purchase Orders with New Exchange Rate
Hello, I have existing Purchase Orders in Great Plains 8.0 were some of the line items have been received is there a way to change the exchange rate for the remaining line items and any new line items added? Thanks, Brian M. Database Administrator ...

Carriage Return/Line Feed Problem
Hi guys, I wrote some code that gets the HTML from a Web page and stores it in a buffer, then I display the buffer in a big multiline CEdit box. The problem is that on many pages I don't get new lines, I just get a thick solid verticle line kinda like this: || where it should return. Also, if I view the pages (view source) in Notepad they look fine. Most pages do that, but interestingly Microsoft pages do the proper new line and look great in my edit box. Maybe I have to replace all the \r with \r\n or something like that ? Does a \r\n still only take up 1 char ? I download the page in...

can't find form
i have a command button on a form [frmMainMenu] that when clicked, closes that form and opens another [frmFixtureSchedulePrintOptions]. The 2 share the same table as a record source, so i'm doing this to avoid conflicting updates the code behind [frmMainMenu] reads like this (below), and functions correctly DoCmd.Close stDocName = "frmFixtureSchedulePrintOptions" DoCmd.OpenForm stDocName, acNormal on the new form [frmFixtureSchedulePrintOptions], there is a command button to save to close itself, and open the previous from [frmMainMenu], and the ...

Form Summarys
I want to know if i can write up my form on excel and then on anothe sheet it summarizes it so i have a log of all the forms i send out bu each time i create a new form can it create a new summary underneat the old one ?? Many Thanks:D Ben -- Message posted from Does this mean that you have certain cells that you want to track? If yes, then you could run a macro when you're done with the form: Option Explicit Option Base 0 Sub testme01() Dim myCellAddresses As Variant Dim FormWks As Worksheet Dim LogWks As Worksheet Dim nextRow As Long D...

replacing a credit card account with a new account with same institution
My credit card was just replaced causing some credits and debits on the old account and transferred to a new account. Do I need to merge these accounts? When I update the accounts I only get a balance on th enew account and no transactions. Any advice would be appreciated. In, wrote: >My credit card was just replaced causing some credits and debits on >the old account and transferred to a new account. Do I need to merge >these accounts? When I update the accounts I only get a balance on th >enew account and no transactions. Any advice...

recording keystrokes
How do I record keystrokes and then evoke a command to repeat those keystrokes? For instances; I want to change the first word in a numbered list in the document all the way through the document. You cannot record loops with the macro recorder. The following will replace the first word in each paragraph in the selected text with the word(s) defines in sText Sub ReplaceFirstWord() Dim oPara As Paragraph Dim sText As String sText = "Replacement Text" For Each oPara In Selection.Range.Paragraphs oPara.Range.Words(1).Text = sText & Chr(32) Next oPara End ...

Import Customer Records
I am trying to import customer records and I am running into the following error: DOC 1 ERROR: Are you sure you want to delete this customer record? Ln 810 Col 2, Update module, Last CBOM field read was root.'Customer ID', Last window field visited was 'Clear Button' of window 'RM_Customer_Maintenance' of form 'RM_Customer_Maintenance' Any ideas? Thanks! Are you on the latest integration manager service pack? Best regards, -- MG.- Mariano Gomez, MIS, MCP, PMP Maximum Global Business, LLC The Dynamics GP Blogster at h...

using program to record audio comment and compress audio to MP3
I can use VBA to record an audio comment into a Word file using Selection.InlineShapes.AddOLEObject ClassType:="SoundRec", FileName:="", _ LinkToFile:=False, DisplayAsIcon:=True, IconFileName:= _ "C:\WINDOWS\system32\sndrec32.exe", IconIndex:=0, IconLabel:="Wave Sound" BUT but by default the file is stored as a PCM at 44kHz and 16 bit stereo whcih is about 200kB per second Sound recorder (which is used to do the recording) allows me to manually convert this to a MP3 and a much smaller file e.g. 3kB per second Is there any way I can aut...

Pass infomration from a form to a report...
I have a form that displays a certain fields from a specific record. How can the selected values be passed to create a report? From my understanding reports can only get information from tables and queries. How can I query th information from a form? Thank you for any help, George On Fri, 26 Mar 2010 12:13:31 -0400, George <> wrote: >I have a form that displays a certain fields from a specific record. How > can the selected values be passed to create a report? > From my understanding reports can only get information from ta...

How do I read in a record / row from a table.
Hi, I have a form where I need to read in the parameter setting for the current user. I know I can use DLookup but I have to lookup about 14 different parameters off a single row. But that seems quite inefficient. I need to read the record and extract the values from the record / row. Thanks. -- Dennis Dennis Here's one possible approach ... there are many ... You could create a form that is bound to that record, and make the form hidden. You can refer to controls on the form with: Forms!YourForm!YourControl Regards Jeff Boyce Microsoft ...

Return a "" value from a formular
Any help greatly appreciated: I have 2 formulars that works, but I want them to return nothing eg "" when there is nothing entered into a cell, at the moment they return the 'false' value. My formulars are: =IF(O12>O11,"End milestone deadline passed","OK") =IF(AND(O12>O11,OR(D12>D11,E12>E11,F12>F11,G12>G11,H12>H11,I12>I11,J12>J11,K12>K11,L12>L11,M12>M11,N12>N11)),"End milestone passed and 'Actual's' late","End milestone passed but 'Actual's' OK") =IF(isblank(O12),&...

Problems Sending Messages to domains w/ multiple MX records
Got a question for the Exchange experts out there. We have a wierd situation occuring where e-mails we send to domains w/ multiple MX records either do not get through or the recipient receives the message multiple times until we manually delete the message in the ESM/Queues. All other messages get through fine. We have come to this conclusion (problem is with multiple MX records) by testing the domains we are having problems w/ using DNS Lookup tool for MX records. All of them come back w/ multiple MX records. Here is what has changed recently: We moved to a new locat...

Continuous Forms
Hi I have a subform with the records displayed in the Continuous Forms view. On each line, I have a group & a subgroup. Both fields are Combo boxes. What I am trying to do is limit the choice of subgroups to those pertaining to the group shown. I have tried putting code in the On Current event in the form to allow only the correct subgroups in the Combo box, but it seems to take the criteria for the top record & apply it to all the others. This is the code:- Dim strSQL As String strSQL = "SELECT TLK_SubGroups.PK_SubGroup, TLK_SubGroups.TXT_SubAbriv, TLK_SubGroup...