Loading data into a Form through Macro/Module

Accesspert

Registered User.
Local time
Today, 15:10
Joined
Feb 16, 2006
Messages
36
Hi, I'm new to this Access programming.
I'm designing a database that will pull employee information onto a form.
I've designed the form but now my problem is getting the records from the query/tables i've designed into the form.
I can see my data in my comboboxs when I open the drop down, however when i first load the form the form looks empty. I want it to show the first record.
If anyone can help me with the coding it would be greatly appreciate it.
Thanks.
 
This may sound like a dumb question, but your form does have a record source coming from a query or table, correct?

I guess, could you give a little more detail?
 
Yes it does.
What i've done is i've designed some textboxes and comboboxes and I've added an add new botton and delete botton. Now when I first load the form I want it to show the first record in my query. I can see that my record information is in the comboboxe's but i have to drop down the menu in order to see it. I wanna be able to see the first record by default and whenever I click on next record for it to go to the next and so on.
 
Is the form's DataEntry property set to Yes? It should be No.
 
I can't find the DataEntry Property when I right click on the form so I don't know if it's set to Yes or No.
 
Open your form in design view, select the very top left square and right click, select properties. The 'Data Entry' property is in the 'Data' tab and should be set to no.
 
maybe you can use the onload event and hardcode the control to goto record 1 by default
 
The Data Entry was already set to No.
Can you explain further please how I would make it to go to record 1 by hard coding? Sorry i'm really new to all this.
Thanks
 
Hi,

I'm not sure if this is the best way to do it, but it works for me. Firstly, you need to write a macro and call it whatever you like. The macro action should be 'goto record' and the 'Record' (at the bottom left) should be first, last or new, depending on which record you want to show. In the properties of the form, click on the event tab. You will see a category called 'On Open'. In this category, put the name of your macro that you created previously. When the form opens, it will run the macro, and hopefully, show the record you wanted in the form.
It isn't exactly VBA, but, as I said before, it works for me.
 
Can you explain further please how I would make it to go to record 1 by hard coding? Sorry i'm really new to all this.
NO code is required to get a form to open to the first record of a recordset. The form needs to be bound to a query or table and the DataEntry property (on the data tab) needs to be set to No. That's it!!!!

If your form is not bringing up any records, check the query.
 
Might be easier if you post your db so we can have a look at it.
 
I tried the Macro thing that you told me and it still didn't work. This is driving me nuts.
I tried to attach my db but the file is too big it's 410kb so it won't let me attach it.
 
Firstly, compact the db using database utilities (in the tools menu), then zip it with a file compression application (such as winzip, 7-up, stuffit etc) then try and post again. If it is still too big, make a copy and remove the tables that don't relate to your problem specifically then try again.
 
Alright, I've attached my db. The two forms that I'm working on are called frmWorkforceDataEntry and frmServiceQualityAssessment.
The one that I'm having problem showing the first record when the form loads is the frmWorkforceDataEntry. With the frmServiceQualityAssessment I want to do the same but when the CSR Name is selected the TL Name needs to change to the right one. I'm not sure how to do that either.
Thanks a lot for ur help, i really appreciate it.
 

Attachments

I figured out the problem guys, it was really stupid. I hadn't connected the actual form itself to the correct query.
 
But now i have another problem. When I open my form I get a pop of message saying Enter Parameter value tblEmployeeInformation.strEmployeeNumber. I don't even have that field, my field is called intEmployeeNumber. And when I click cancel it shows me another one that says tblSystemInformation.stEmployeeNumber
 
At some point, you referenced the other name. Open the query properties and look at the filter and sort properties. Those are the likely culprets.
 
There's nothing there. Does this mean I have to recreate the form?
 

Users who are viewing this thread

Back
Top Bottom