Form, import

yessir

Saved By Grace
Local time
Today, 16:53
Joined
May 29, 2003
Messages
349
I am having the stupidest time with a form...

I have the form to import data from a file.

the code in the command30 button is what is giving me the trouble though.

I am going to have it run automatically after the import.

The problem is that If the loop encounters a value not in the maintanence table it asks if you want to add it to the maintanence table.

if you chose no, then I want to flag it using a yes/no field called ERR_MATRIX.

the problem is that it doesn't update the recordset.

Can Someone Please help me with this!!

~ :confused:
 

Attachments

Wow

Neat trick. How did you get the form to go full screen like that? Modal, Popup and then DoCmd.Maximize?

I think test_2 sort of works.

You might find it a lot easier to use only recordsets rather than recordsets plus queries.

If you want to move something from the top of a recordset to the bottom, the easiest way might be to create a record_Sort_ID field in the underyling table and then set this to the largest number so far contained in that field + 1 (DMAX would get this). Then you won't have to delete a record and then write the exact same record back into the table.

If you really do need to write records and delete others you could use two Recordsets opened on the maybe the same table with the following code:

Code:
    RS2.AddNew
    for j = 0 to RS2.Fields.Count-1
        RS2.Fields(j) = RS1.Fields(j)
    next j
 

Attachments

yeah, pop up, modal docmd.maximmize is how that is done...

also turn off the control buttons and make the border = none
 
Can you help me do this in all recordset?

It would cut down on code and probably make things a LOT easier


...


Also, the MAIN intent of setting the flags is so that the user can input a different value from a dropdown.

Is there a way to open frmrecedit and wait for a return of a value from that form before moving on?
 
Waiting for a return value

If you open a form as a dialog

Code:
    DoCmd.OpenForm "pop_Name", , , , , acDialog, str_Args
code execution will wait until the dialog is closed.

Getting hold of the return value? There are probably a few ways of doing this, and the way I tend to do it is probably not the best.

Easy way:

Declare a global variable (Global gloB_1 at the top of a module - a not a form's module, a form-independent one), then set the value of this variable in the Close event of the popup.

Code:
Private Sub Form_Close()

    gloB_1 = some_value

End Sub
When the popup closes, the value you set will then be available to the waiting form too. gloB_1 is global so you can refer to it anywhere in the application.

Not so easy way (but the one I tend to use):

Make a Public function on the waiting form that will take the values you'll need

Code:
Public Function value_From_Pop_Up(arg_1)

    fVar_1 = arg_1

End Function
fVar_1 is declared (Dim fVar_1) right at the top of the waiting form's module so it's a form-level variable, and is visible to any procedure on the waiting form.

Call the function from the close event of the popup.

Code:
Private Sub Form_Close()

    Form_waiting_Frm.value_from_pop_up (some_value)

End Sub
Both these methods should work.

I kind of feel that there should be a way of setting the value of a function/sub-level variable from a popup so that the variable doesn't even have to be form-level never mind global, but I can't think of a way of doing this.

If you need help converting to recordset code, I'll try and get some pointers to you fairly soon.
 
I Really would like to be able to do all of this in the recordset

PS thankyou very much, for some reason the whole open the form and return a value thing works now.

I open it and when the user chooses OK then i set it to invisible, set the active form hidden_temp to the popups value then close the popupform and volia!

Your Help thus far is GREATLY appreciated...

~ :D
 
Here is an updated version ( and working relatively well ) of what I wanted to do.

I am now looking for suggestions and help on improving the form command30 button.

I think that the barrage of popups if the same entry occurs more than once is a problem. Is there a way to update ALL the records for which contain the value throwing the error upon return?

Say Matrix asks if you want to add 'Test' to the maintanence table
you say no
then it asks you to choose another value from the popup
it then updates the current record from 'Test' to chosen value as well as all other records where Matrix = 'Test'
Then continues to check all the values as it was.

Thanks for any help in advance,
~ :)
 

Attachments

Last edited:

Users who are viewing this thread

Back
Top Bottom