Populating a record from an on command button

Jason1

Registered User.
Local time
Today, 16:14
Joined
Mar 12, 2010
Messages
63
Hello,

I am trying populate a record with the click of a button.

I have attached a copy of my DB. You can see I am just trying to work the little bugs out at the moment before I put it to use.

This is what I am trying to make happen. As you can see the DB is designed to track and schedule preventitive Maintainance on a piece of equipment. Basically a PM is scheduled in TblPmSchedule. It is then searchable by date with frmPmWorkload. This brings up a report with hyperlinks to the actual PM data in time frame requested in frmPmWorkload. Once the technician finishes the PM he can enter the data from the job on the form that comes up with the hyperlink. When the data is recorded the tech presses the done button which saves the record of the pm, marks the "completed" check box on tblPmSchedule, and I want it to reschedule (create a new record in tblPmSchedule) based on the "interval" in tblPmList.

This is probably way above my head, but I have been tasked with making this happen, and I'm hoping you guys can be as helpful as usual.
 

Attachments

just run an append query.
records save automatic, so save and run the query:
Code:
sub btnSave_Click()
 chkDone = true       'mark checkbox completer
        'run the reschedule query based on the interval
 docmd.setwarnings false
 docmd.openquery "qaReschedule"
 docmd.setwarnings true
end sub
 
hi jason.

Just a heads up, I would avoid using lookup fields in tables.
see - http://access.mvps.org/access/lookupfields.htm

also I would re-think using hyperlinks as a method to opening forms. Using the docmd.openform method would enable you to pass parameters to the newly opened form. A quick look at your code leads me to believe you are making things much harder for yourself than it should be.
 
take a look.
see the changes in the code in frmGoliathLubeChainPm.
as practice, do same logic programming with
the other form, frmGoliathCheckDriveUnitPm.
 

Attachments

Thank for the help guys. As you can see I know nothing when it comes to writing code. I try to use the standard stuff inside Access as much as possible because it is all I know. Do you guys have any suggestions for a good place to learn to write VB. I'm talking starting from the very very basic.
 
hi jason.

Just a heads up, I would avoid using lookup fields in tables.
see - http://access.mvps.org/access/lookupfields.htm

also I would re-think using hyperlinks as a method to opening forms. Using the docmd.openform method would enable you to pass parameters to the newly opened form. A quick look at your code leads me to believe you are making things much harder for yourself than it should be.

Moke,

forgive me ignorance, but what option would you use to get away from using the lookups the way I have?

Jason
 
@Jason1,

Rather than create a lookup in the table itself, you will normally want to create a query that shows ONLY the values you are interested in then add a combobox running off of that query. This gives you, the programmer, the greatest versatility in customizing a form while avoiding issues with table level lookups.

Before you create the form, make the query.
When you make the form, drop the field on where you want it.
After the field is on the form, click on it and change it to a combobox.
Open the properties and set the data source to be your query.
 
Mark,

I think I got it, that makes total sense, limit the possible entries in the form instead of the table. Thanks for that.
 
take a look.
see the changes in the code in frmGoliathLubeChainPm.
as practice, do same logic programming with
the other form, frmGoliathCheckDriveUnitPm.

Arnelgp,

Thanks for this, I looked through it, and it basically does what I want. I will need to modify it to give me the correct date I think, as it currently just give the completion date. I really struggle with understanding the code, but I am going to pick through it, and I think I will be able to get what I want using this. I really appreciate the help.
 

Users who are viewing this thread

Back
Top Bottom