DOC PREVIEW
EIU CIS 3000 - VB5

This preview shows page 1-2-3-4 out of 12 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 12 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 12 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 12 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 12 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 12 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Miscellaneous Visual Basic Questions and AnswersScreen/Button ManipulationsSubroutines/FunctionsAutonumber in ACCESSHow to do a query on an integer fieldDate Fields and FunctionsAnother Date MethodAdvantages/DisadvantagesHow to add the next order recordPowerPoint PresentationMsgboxSlide 12Miscellaneous Visual Basic Questions and AnswersScreen/Button Manipulations•Unload Form•Load Form•Form.Show•Form.Hide•ControlButton.Visible = True/False–cmdNextPage.Visible = True (shows the button)–cmdNextPage.Visible = False (hides the button)Subroutines/Functions•Access to variables–Form variables–Global variables–arguments passed to/from the function•Calling statement–Call functionname (arguments)•Function statement–Private Function functionname (arguments)Autonumber in ACCESS•Order number in ACCESS can be defined as autonumber•Autonumber is a “long integer”•Access will automatically increment the order number by one for each new order–Visual Basic is not so nice!How to do a query on an integer fieldDim strFind as stringDim num as Integernum = val(txtOrder.text)strFind = “[Order Number] = “ & numdatOrder.Recordset.FindFirst strFindIf datOrder.Recordset.Nomatch then msgbox (“order number: “ & txtOrder.text & “ not on file”)End IfDate Fields and Functions•lblDate.caption = Now–Now: mm-dd-yy hh:mm:ss•What if you only want part of this field–orddate = Now–lblMonth.caption = Month(orddate)–lblDay.caption = Day(orddate)–lblYear.caption = Year(orddate)–lblDate.caption = Month(orddate) & “-” & Day(orddate) & “-” Year(orddate)Another Date Method•Create a field in Access: order date–Type: Date/Time–Subtype: Short Date (mm-dd-yy)–Default: Now()•ACCESS will automatically short today’s date in the mm-dd-yy format on any records added to the ACCESS database by Visual BasicAdvantages/Disadvantages•Allowing ACCESS to insert today’s date automatically•Using functions in Visual Basic to update the fields with the dateHow to add the next order recordDim newnum as integerDim orddate as datedatOrder.Recordset.MoveLastnewnum = datOrder.Recordset.Fields (“Order Number”).value + 1datOrder.Recordset.AddnewdatOrder.Recordset.Fields (“Order Number”) = newnumdatOrder.Recordset.Fields (“Customer Id”) = txtCustID.txtorddate = now ‘date mm-dd-yy and hh:mm:ssdatOrder.Recordset.Fields(“Date of Order”) = Month(orddate) & “-” & Day(orddate) & “-” & Year(orddate)datOrder.Recordset.UpdateOmit code in brackets if default value is set in ACCESSMsgbox•MsgBox “prompt”–Default is the vbOKonly button–Same sa MsgBox (“prompt”, vbOKOnly)–MsgBox(“prompt”, VbOKOnly, “window title”)•Can display variables in the “prompt”–Msgbox (“this is a prompt ” & txtSSN.text)–MsgBox (“prompt ” & intNumber & “ the end”)Msgbox•If you want to use other buttons:–vbYesNoCancel; vbYesNo; vbRetryCancel–need to Dim Response as Integer–response = MsgBox(“prompt”, vbYesNo, “title”)•Response = 6 for Yes; 7 for no; 3 for cancel•Can combine icon and buttons:–response = MsgBox(“prompt”, vbInformation + vbYesNo, “title”)–Options for icons:•vbCritical


View Full Document

EIU CIS 3000 - VB5

Download VB5
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view VB5 and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view VB5 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?