473,412 Members | 2,277 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,412 software developers and data experts.

complex form operations?

AccessIdiot
493 256MB
Please forgive as I am an Access and VB newbie.

For what it's worth, here is my complete setup. Maybe it will help or maybe it will just confuse but I'll outline it anyway.

I have a main form that has 3 buttons. Each button opens the same form (frm_Survey) but passes a different string to the form. When a button is clicked the main form is closed to prevent the user from pressing another button. The form that is opened is frm_Survey. The string that is passed from the button via OpenArgs is concatenated with an integer that the user enters in an unbound textbox on frm_Survey and that value is put in the table (tbl_Survey) and also populates a disabled field (txt_SuveyNumID).

So for example, the user hits the "Trawl" on the main form. The main form closes, frm_Survey opens, and 'TR' is passed to frm_Survey. On frm_Survey the user types in "2" and in txt_SurveyNumID you would see "TR2" which also gets entered into SurveyNum field of tbl_SurveyNum.

There is a button on frm_Survey that launches frm_Replicate. The concatenated field from frm_Survey (txt_SurveyNumID) should also show up on frm_Replicate (getting passed by OpenArgs) and be entered into the table that feeds frm_Replicate (tbl_Replicate - they are linked by a one to many relationship: one survey can have many replicates).

There is a button on frm_Replicate that adds a new record (New Replicate). The user should be able to add as many records as they like, keeping that concatenated field that was passed from frm_Survey (txt_SurveyNumID). When they are done, they should be able to click on a New Survey button that closes frm_Replicate and return to frm_Survey. Now the user can change the number in the integer field, which is concatenated with the string passed from the main form, click a button to open frm_Replicate again, and start over with the new concatenated value.

In other words, "New Survey" button closes frm_Replicate. Type "3" into the field on frm_Survey and you should now see "TR3". Hit "New Replicate" and frm_Replicate opens with "TR3" as Survey_Num.

I hope this isn't too confusing. If it would help to draw a picture I can do that if you tell me how to upload attachments.

Now here are my problems:

1) When I hit "New Replicate" button on frm_Replicate it doesn't advance to a new record. I get an error message: "Can't go to specified record". This is the code on the button:
Expand|Select|Wrap|Line Numbers
  1. Private Sub btnNewReplicate_Click()
  2. On Error GoTo Err_btnNewReplicate_Click
  3.  
  4.     DoCmd.GoToRecord , , acNewRec
  5.  
  6. Exit_btnNewReplicate_Click:
  7.     Exit Sub
  8.  
  9. Err_btnNewReplicate_Click:
  10.     MsgBox Err.Description
  11.     Resume Exit_btnNewReplicate_Click
  12.  
  13. End Sub
2) When I click on "New Survey" frm_Replicate closes like it should, but I need the data that is currently on the frm_Survey to get entered into the table and then advance to a new record so I can change the Survey_Num. How do I do this? Right now if I change the integer and go to a New Replicate then whatever was last in the field is what is getting entered. In other words, if first it is TR2 and then I go back and change it to TR3 then only TR3 is going into the database. I think I need some kind of Requery somewhere? Maybe on the button on frm_Replicate that goes back to frm_Survey (New Survey)?

I have all sorts of code snippets that I can provide as well if that would help.

Thanks in advance and sorry for the long post!!

cheers,
melissa
Mar 14 '07 #1
8 2446
Rabbit
12,516 Expert Mod 8TB
Rather than a new form, could I suggest a continuous subform on frm_survey? If you link the master and child fields the foreign key will transfer automatically.
Mar 17 '07 #2
AccessIdiot
493 256MB
Thanks for your response, I'm trying this now.

Cheers!
Mar 19 '07 #3
Rabbit
12,516 Expert Mod 8TB
Good Luck, let us know how you get along. If you get this working correctly, you can hide the field on the subform altogether so they won't be able to change it.

Also, if you set up the relationship to cascade updates and cascade deletes, then whenever they delete or change the primary key value for a record, it updates to the linked table. And if they delete a primary key value, it deletes all records in the linked tables with the same foreign key value.
Mar 19 '07 #4
NeoPa
32,556 Expert Mod 16PB
I would certainly support that advice (about the cascading updates/deletes) Melissa.
Can you let us know if this question is still current. From your other thread I feel this may have been superceded?
Mar 20 '07 #5
AccessIdiot
493 256MB
I've got things working with a subform and form. I'd link to learn more about cascading as you suggested but I'm going to post in the other thread I started about locking/disabling as it is more pertinent there.

Thanks for your help!
Mar 20 '07 #6
NeoPa
32,556 Expert Mod 16PB
Can you post a link in here to your other thread then, so I can check it out.
Mar 20 '07 #7
Rabbit
12,516 Expert Mod 8TB
The thread is here.
Mar 20 '07 #8
NeoPa
32,556 Expert Mod 16PB
Thanks Rabbit. Top man.
Mar 20 '07 #9

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

Similar topics

3
by: Peter Olsen | last post by:
I want to define a class "point" as a subclass of complex. When I create an instance sample = point(<arglist>) I want "sample" to "be" a complex number, but with its real and imaginary...
2
by: WATYF | last post by:
Hello. I have a multi-threaded app that has a few different Timers all of which deserialize and serialize objects to perform certain operations. At the same time, the user can be working in the app...
12
by: vj | last post by:
Hi! I have a piece of code (shown below) involving complex numbers. The code is not running and giving error ("Invalid floating point operation" and "SQRT:Domain error"). I would be very...
17
by: Julian V. Noble | last post by:
Dear C Mavens, I am writing a Computing Prescription for CiSE on complex arithmetic. I would like to be sure that I do not include any gaffes about C99--especially about what is in the header...
3
by: Klaas Vantournhout | last post by:
Hi, I am using CLAPACK to do lots of matrix operations, but this is done on complex matrices. There I also need to work with normal complex operators, I use also the standard complex library. ...
2
by: polocar | last post by:
Hi, suppose that you have a C# form with two buttons, that are the classical "btnOk" and "btnCancel" (besides them, of course in the form there can be many other controls). When the user clicks...
14
by: David Marsh | last post by:
Can someone show me or point me to an example of declaring and initializing complex numbers in C99? Also, in looking at complex.h, I don't see any library calls for + - * or /. How are the basic...
27
by: David Marsh | last post by:
I understand that C99 supports a complex type and complex arithmetic. There is nothing about it in the FAQ and online searches turned up very little except synopses. Can anyone point me toward...
4
by: BiDi | last post by:
I have been trying to subclass complex, but I am not able to get the right-hand arithmetic operators working. As shown below, if an object of my subclass 'xcomplex' is added on the right of a...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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:
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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
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
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,...
0
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...

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.