My Assistant
![]() ![]() |
|
|
Apr 20 2006, 10:01 AM
Post
#1
|
|
|
New Member Posts: 8 |
I have a form with a list box that shows a list of requests that are unassigned.
When you double click on the list box, I want a different form to open. All of the text boxes on the second form are unbound. I want to specifically set the value of each field, but Access won't let me use the word me! For example, if I were trying to do this all within the same form, I can use the code below: me.txt_request_id = !Request_ID How do I do this from a different form? The Visual Basic help says I should be able to use this code but it doesn't work: Forms!NAME_OF_FORM.Controls!txt_request_ID.text = "Some Value" I've tried every variation of this that I can think of and nothing works!! Please help! I am building this database for work and I'm already behind schedule. I've looked in every Access book I have and can't find anything that will work! |
|
|
|
Apr 20 2006, 10:06 AM
Post
#2
|
|
|
UtterAccess VIP Posts: 31,413 From: NC, USA |
Hi,
welcome to UA forums. Check this FAQ for reference issues. If you execute this from the form with the listbox on it then the code would be: Forms!YourOtherForm.YourOtherFormsControl = "Some Value" HTH Good luck |
|
|
|
Apr 20 2006, 10:28 AM
Post
#3
|
|
|
New Member Posts: 8 |
No luck freakazeud!!
From the listbox form I first opened the other form (Named Assignment_Form) with this line: DoCmd.OpenForm "Assignment_Form", acNormal Then I tried this: MsgBox Forms!Assignment_form.txt_Request_ID I get the error: "Method 'Item' of Object 'Forms' failed" I also tried: MsgBox Forms!Assignment_form.txt_Request_ID.text MsgBox Forms!Assignment_form.txt_Request_ID.value No Luck! |
|
|
|
Apr 20 2006, 10:34 AM
Post
#4
|
|
|
UtterAccess VIP Posts: 31,413 From: NC, USA |
Try to wrap you names in square brackets:
Forms![Assignment_form]![txt_Request_ID] Make sure the form is open when you call this. HTH Good luck |
|
|
|
Apr 20 2006, 10:45 AM
Post
#5
|
|
|
New Member Posts: 8 |
Thanks freakazeud, but still no luck.
I get the same error: "Method 'Item' of Object 'Forms' failed" |
|
|
|
Apr 20 2006, 10:48 AM
Post
#6
|
|
|
UtterAccess VIP Posts: 31,413 From: NC, USA |
Can you attach an example db so I can take a look at it?
HTH Good luck |
|
|
|
Apr 20 2006, 11:04 AM
Post
#7
|
|
|
UtterAccess VIP Posts: 12,201 From: Tacoma, WA. |
Freak,
Could be mis reading the posters request but could it be that: The form opening the form to be opened is closed? The Expressions are not on the form to be opened? Just A Thought |
|
|
|
Apr 20 2006, 11:07 AM
Post
#8
|
|
|
New Member Posts: 8 |
It won't let me attach the database. I tried just changing the extension to .jpg. I don't know if you'll be able to convert it back to .mdb.
The Main form I am working with is "Unassigned_Request_Search". This form has the list box. When you double click it, I am passing the value of the Request_ID to a Public Function called "Open_Assignment_Form(Req_ID As String)". Then within the public function I am opening the second form called "Assignment_Form". That's where I get stuck. I added some notes to the code! Thanks for taking a look at this! |
|
|
|
Apr 20 2006, 11:10 AM
Post
#9
|
|
|
UtterAccess VIP Posts: 31,413 From: NC, USA |
You have to zip up the mdb file and it has to be under 500kb (do a compact and repair if it is too big or take some stuff out).
As I mentioned before the form has to be opened when you call this AND you are doing this from the form which holds the listbox. With that info and the syntax I gave you it should work. |
|
|
|
Apr 20 2006, 11:11 AM
Post
#10
|
|
|
UtterAccess VIP Posts: 12,201 From: Tacoma, WA. |
Attachment needs to be Zipped and attached with a .zip extension no larger than 500000kb
HTH |
|
|
|
Apr 20 2006, 11:12 AM
Post
#11
|
|
|
New Member Posts: 8 |
Ok, let's try to attach this again!
Attached File(s)
|
|
|
|
Apr 20 2006, 11:15 AM
Post
#12
|
|
|
New Member Posts: 8 |
There we go! I got it to attach.
John/jmcwk - Yes, both forms are open. Freakazeud - I tried it both from the Public Function, and from the Unassigned_Request_Search form. I get the same error. |
|
|
|
Apr 20 2006, 11:51 AM
Post
#13
|
|
|
UtterAccess VIP Posts: 31,413 From: NC, USA |
Hi,
something is wrong with your database. I imported your two forms and the module and tried it and it worked as supposed to. So try to import your objects into a new blank db. Maybe some dll broke and messes things up because the syntax is all correct. You don't need to do this in a seperate module by the way. Just do it on the double click event. HTH Good luck |
|
|
|
Apr 20 2006, 12:02 PM
Post
#14
|
|
|
New Member Posts: 8 |
Thanks, I'll try that! I am heading to the Dentist for the rest of this afternoon. (IMG:http://www.utteraccess.com/forum/style_emoticons/default/sad.gif)
Do you think it could be a reference issue? Can you tell me what you have referenced? I currently have: Visual Basic for Applications Microsoft Access 11.0 Object Library OLE Automation Microsoft DAO 3.6 Object Library Microsoft ActiveX Data Objects 2.1 Library |
|
|
|
Apr 20 2006, 12:06 PM
Post
#15
|
|
|
UtterAccess VIP Posts: 31,413 From: NC, USA |
There is a possibility that it is a reference issue.
The references seem fine, but they might be broken somehow. So try the import as I did and see if the syntax works then, because it didn't throw an error for me anymore afterwards. HTH Good luck |
|
|
|
Apr 21 2006, 08:03 AM
Post
#16
|
|
|
New Member Posts: 8 |
It worked!
I imported all of my objects into a new db, and it appears to be working fine now! I double checked the references, and everything was the same. I'm not sure what caused this, but at least it is working now! Thanks a ton for all of your help! |
|
|
|
Apr 21 2006, 09:19 AM
Post
#17
|
|
|
UtterAccess VIP Posts: 31,413 From: NC, USA |
You're welcome.
Yeah like I said the references seemed fine, but maybe something just went haywire with them. Glad you got it sorted out. Good luck on future projects! |
|
|
|
![]() ![]() |
|
Go to Top · Lo-Fi Version | Time is now: 23rd May 2013 - 11:27 AM |