(Keep in mind my questions come from someone with little to no practice of VisualBasic. I understand basically how it works, and have taken one class on it; but am nowhere near fluent in it.) And, I am using Access 2003.
1. How do you go about having a text field on a form set up so that right when user gets to the form, a Message Box or Input Box (with accompanying space for user to type) appears saying "Enter Date", so that whatever user enters into that message box is entered into the text field? I'd want to set it up this way so that a user (who will be inputting more data on the form associated with that date) gets prompted for it immediately when going to the form. Then after putting it in, it just sticks there and stays around, because there's two more subforms within this main form that are linked to the various data that's input to the form--such as the date--and that repeat the data.
Snapshot of Form
(old link--now gone)
(just btw, "Week Ending" is the one I want the prompt for, "Developer" is just something that'll be passed through each time, and "Project ID" is a primary key that'll be passed through each time.)
Quote from other topic:
MsgBox is good. But it won't let the user type anything. InputBox will, but not MsgBox.
You can also [ask a Question in square brackets] in a form / report or query. Doing that prompts the user for Enter Parameter Value and that value is returned to the object that has the question in brackets.
By InputBox, do you mean TextBox? I know they're not the same, but I'm not seeing an InputBox on the toolbox of all the form tools (like with TextBox, Label, ComboBox, etc.) And the only help topic in my Help files having to do with "InputBox Function" links me to a Japanese MSDN site. I'm aware of making the "Insert Parameter Value" prompt show up on a query by placing a [statement enclosed in brackets] in the "criteria" section of a given field. However, I do not know where to enclose [a statement in brackets] that triggers an "Enter Parameter Value" pop-up for a text-box on a form. I've tried inserting [Enter Date] in the control source, in the "Build" areas, as simply the name of the text-box, and I just can't seem to get any sort of prompt for user to enter value to pop up like I used to could in the query I was working with. I tried writing a module in VB for an InputBox. But I'm pretty sure my syntax was wrong or I'm not doing something basic, because in the Expression builder, the name of my Module shows up, but I can't seem to select anything out of it.
Now what? I think the code is wrong, and I do not understand how to save Modules such as the one I created, and put them on an event such as "On Got Focus". The VB editor sometimes asks me something about creating a macro, and then it will bring up another code window, which I do not know if I need or not. Then, I'm not sure if I'm supposed to open the module I made, or this macro it asked me to make. And whenever I've tried to use this thing I make, it messes up my form.. So I'm clearly lost, with the VB stuff.
Thanks for the suggestion, but that doesn't seem to be working. I tried this both on the form that I'm designing, and I tried creating a new form and trying this. Both just show the text box with " #Name? " inside of it.
Ok, taking a break from the question about having some sort of InputBox/MsgBox/Pop-up box to enter in the date (I'd still like any help and take any suggestions on this, as I'm still not where I want to be with it), here's my next question, regarding forms/subforms.
2. I'm not doing the two-subforms-inside-one-main-form anymore. Here's a snapshot of how I've re-structured this thing:
So right now, three of them are linked, between form and subform--how can I link all five of them? That is, you put it in at the top, and it goes to the one under it in the datasheet subform. Right now it does it with three of the fields, because that's all the wizard let me set up--is there any way (and if so, how?)--to do it with all five fields?
1. Thanks much, my friend! I'm feeling this InputBox. It's rough'n'ready like you said, and I might be able to sorta play around with some validation stuff and instructing the user stuff. But this is just great for what I'm trying to do.
2. So I'm still wondering/working on getting the new form to link all five fields together, somehow.
Overall I want it set up to where the input-user gets asked the date, they put in in, it's reflected both places on the form*. Then, as they input field-by-field, it puts it in the datasheet form, and once they finish one record, they tab out of that back to that second field at top of form (skip date since it's saved), and input field-by-field again and have it reflected in the datasheet at the bottom as a new record under the first one, and so on and so on**. Then once they get enough records put in for one employee, they hit "new record" at the very bottom of the form, it saves the date, but clears everything out--both on the top form, and datsheet subform. Because when they've chosen "next record", they'll be chosing a different employee to fill out data for; and that's the whole reason behind the datasheet view, just to show a summary of different things/different records worked on by a single employee at a time***.
*Right now, this is done! I just need the other two fields linked.
**Right now, after user fills out last field at top of form, it tabs down to datasheet, and I don't want that--I want it to tab to the second field in the top portion. And when I wrote a macro and configured it to "GoToControl" on the event "On Exit", it DOES go to the right record I want next, but then it doesn't put it into the datasheet.
***Right now, when user clicks "New record" at the very bottom, it asks for date again. I don't want that. I want date saved. But anyway, then as I'm filling fields out, if I try to tab out of that last one at the top of the form, I get an error: "Index or primary key cannot contain a Null value", which doesn't make sense because all of the fields at the top are filled out. No idea why this happens.
I still don't understand why you think you need the subform tbh. I think you are trying to make your life too complex.
IMO, just ditch the idea. Let the users fill in the top section and have your save button just add the whole record to the table, then refresh the subform. Your new button can also set the default value for the date and move the focus to the second field.
I will speak to my advisor on scrapping the datasheet subform idea.
So that button you speak of, would one way of designing that be to just build a single macro consisting of a bunch of those commands and build it into the button so that it just goes down the list of maro commands one-by-one, doing those different things you mentioned? Or would multiple macros be better? Or not macros at all--another way?
Another stipulation I need is that one of the successive fields that the user will input is a drop-down box of items (it's actually the one with the blue circle in the pic I posted). The choices that show up are filtered based on the employee chosen, a couple of fields before. This works great, and all--I've got another query structured to where it does it right, and it sends it to the table and everything how I want after it's chosen. Only problem is, every time I've finished a record, tabbed out and starteda new one, it doesn't refresh that calculation on what new choices to make available in the combo box when a new employee is chosen. Is this the "Refresh" command that you mentioned? Somehow reloading the query, or something when I'm about to start a new record..?