|
-
Jan 17th, 2005, 04:56 AM
#1
Thread Starter
Fanatic Member
What does this code mean?
Hi, being kind of new to coding aspect of Access, i am unware what this does. Can someone please give me a quick explanation? Especially the lines aceditmenu,
Thanks
VB Code:
Option Compare Database
Private Sub Command31_Click()
On Error GoTo Err_Command31_Click
DoCmd.GoToRecord , , acNewRec
Exit_Command31_Click:
Exit Sub
Err_Command31_Click:
MsgBox Err.Description
Resume Exit_Command31_Click
End Sub
Private Sub Command32_Click()
On Error GoTo Err_Command32_Click
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
Exit_Command32_Click:
Exit Sub
Err_Command32_Click:
MsgBox Err.Description
Resume Exit_Command32_Click
End Sub
Private Sub Command33_Click()
On Error GoTo Err_Command33_Click
DoCmd.Close
Exit_Command33_Click:
Exit Sub
Err_Command33_Click:
MsgBox Err.Description
Resume Exit_Command33_Click
End Sub
-
Jan 17th, 2005, 05:03 AM
#2
Thread Starter
Fanatic Member
Re: What does this code mean?
Hi, in regards to this, all i would like to do is: put two option boxes, if one is pressed then show in report 1 and if the other is pressed then show in report 2.
How can i do this simply. Access is not my favourite program. I am good at VB, if there is any vb code without the aceditmenu commands.
If it helps i would like to know what they mean please?
-
Jan 17th, 2005, 05:51 AM
#3
New Member
Re: What does this code mean?
Private Sub Command32_Click()
'The above difines the sub routine of the On Click propertry of a command button
On Error GoTo Err_Command32_Click
'During execution of the code, if there is an error, the running of the code will "GoTo" the sub routine Err_Command32_Click: At that time you will recieve a message that tells you what the error was.
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
'The code above is the default VBA that Access creates when a command button is created to delete a record. It tells the program to go to the Form Bar and activate the Edit Menu. From there, the numbered code describes the action to take. "8" tells the program to select the current record and the "6" tells the program to delete the currently selected record. The "acMenuVer70" coinsides with the version of access that you have to understand what the preceding code is that you asking it to do.
Exit_Command32_Click:
Exit Sub
'This code exits the sub routine
Err_Command32_Click:
MsgBox Err.Description
Resume Exit_Command32_Click
'This code creates the message box to tell you about your error (if you have one)
End Sub
'This code ends the sub routine
-
Jan 17th, 2005, 05:57 AM
#4
Thread Starter
Fanatic Member
Re: What does this code mean?
This is somebody elses program, and poorly done. By the way, thanks for the explanation, 99% of it i understood, just the aceditmenu thing.
What i don't get is,after you press add new records, it somehow,adds it to the report. I am assuming this would be done, by transfering it to a table and then the report picking up the info from the query table.
Is that how it would work?
If that is the case, then say i had 2 options, i printed to one report, and the other printed to the another report, then to do this i would have to have another query table and another report, is that correct?
-
Jan 17th, 2005, 06:05 AM
#5
Thread Starter
Fanatic Member
Re: What does this code mean?
Hi again, require a bit of help. If i have several comboboxes, each getting data from other tables, how do i save the whole collection of the information into another table?
-
Jan 17th, 2005, 06:22 AM
#6
Re: What does this code mean?
Very poor - I hope its not a db used by a company (joke)
The last post you put up, the best way is to make a table which holds all the unique IDs from the combo boxes (plus other fields if required for text input). As to the save you could either rely on access, or do it manually, these options have been discussed loads of times as bound or unbound forms.
Search the forums, web or text books.
If you code and have a problem, not related to this thread, make a new post and add in the code, people will assist you towards your goal.
Feeling like a fly on the inside of a closed window (Thunk!)
If I post a lot, it is because I am bored at work! ;D Or stuck...
* Anything I post can be only my opinion. Advice etc is up to you to persue...
-
Jan 17th, 2005, 06:27 AM
#7
Thread Starter
Fanatic Member
Re: What does this code mean?
Lol it is one used by a company. But some idiot who made the program before, was exactly that an idiot. No programming experience what so ever.
Took me ages to understand what was going on. One basic rule of programming is to rename components to meaningful names allowing others to have a better understanding. What this idiot do, leaves them.
All i did was add another field, another report and another query.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|