Heres is my code behind the button that opens the new form
------------------------------------------
DoCmd.OpenForm "frmAddInspec", OpenArgs:=strProject & ";" & strArea & ";" & strReference
my form which has the button the open form "frmAddInspec" is called .. "frmSearch"
I put
Unload frmSearch at the end of the first part of my code and got an error... variable not defined.. What am i doing wrong ??
ah silly me, have a look in the project explorer section on the left of the screen and see what the name of your form is there it's probably summat like form_frmsearch try that instead
that would normally mean something like you were trying to close a report but had told it to look for a form, if no playing about with the code works you could try using a macro instead maybe? they're just as quick and a lot easier to set up if you don't like coding
Yes.. What's going on is.. on my form1 I'm pulling a specific record that the user specifies.. then continuously Im pulling info from form1 and transferring it to form2 so that the user can fill out the rest of the info. I'm using a module to do that..
Is there not another way to just close the form when i open form2.. wouldnt know where to start with wat you suggested...
get the docmd.close line to work, this shouldn't be acting up as you say it is, you could try inserting this line with no arguments BEFORE the line which opens up form2 as docmd.close on its own closes the current object although the code in my previous post should work.
You could just hide form1 with form1.visible = false
I really do think that docmd.close acform, form_frmsearch
is the best option, when it pops up with an error click help instead and see if that gives you a hint as to why it's not working.
oh and the first line you've got up there doesn't look quite right, should there not be a load more commas before your openargs statement, I think it should look something like:
DoCmd.OpenForm Form_frmaddinspec,,,,,,OpenArgs:=strProject & ";" & strArea & ";" & strReference
as you seem to have the args in the section which tells it wether to open in design mode etc.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.