access Database Programming Problem

J

JudithSpurlock

If anyone can help me out i would appreciate it. the program states to
declare a user-defined type call HomeData with elemements StreetAddress,
City, State, SquareFootage, LotSize, and SalesPrice in a standard module.I
don't know how to find the Add Procedure dialog box in the visual basic
screen to set it to focus, Select insert, Proceedure from the menu. The next
instructions are as folllows. Create a form with six text boxes to add values
to each variable type element. which i created. In the general declarations
area of the form, create a single variable of HomeType to store users entered
value. I don't know what this means or how to do it i created a text box for
this. the next instructions are as follows. Add two command buttonsto the
form, one called cmdAddHome and the cmdDisplayHomeData which i did. the next
instructions i don't understand at all. In the cmdAddHome Click event, store
the Data entered by the user into your user-defined type variable. In
cmdDisplayHomeData Click event, Display each element's value in a message
box. I don't know how to program this program. Can anyone help or give
suggestions Judith Spurlock
 
J

JudithSpurlock

JudithSpurlock said:
If anyone can help me out i would appreciate it. the program states to
declare a user-defined type call HomeData with elemements StreetAddress,
City, State, SquareFootage, LotSize, and SalesPrice in a standard module.I
don't know how to find the Add Procedure dialog box in the visual basic
screen to set it to focus, Select insert, Proceedure from the menu. The next
instructions are as folllows. Create a form with six text boxes to add values
to each variable type element. which i created. In the general declarations
area of the form, create a single variable of HomeType to store users entered
value. I don't know what this means or how to do it i created a text box for
this. the next instructions are as follows. Add two command buttonsto the
form, one called cmdAddHome and the cmdDisplayHomeData which i did. the next
instructions i don't understand at all. In the cmdAddHome Click event, store
the Data entered by the user into your user-defined type variable. In
cmdDisplayHomeData Click event, Display each element's value in a message
box. I don't know how to program this program. Can anyone help or give
suggestions Judith Spurlock


This is part of my code for the module i don't know if it's correct
Option Compare Database
Option Explicit

'Define User defined type in a standard module

Type Home

StreetAddress As String
City As String
State As String
SquareFootage As Integer
LotSize As Integer
SalesPrice As Currency

End Type

This is another part of my code for the click events and it's giving me an
error
Option Compare Database


Private Sub cmdAddHome_Click()

'Declare one variable of HomeData Type
Dim myHome As Home

myHome.StreetAddress = txtStreetAddress.Value
myHome.City = txtCity.Value
myHome.State = txtState.Value
myHome.SquareFootage = txtSquareFootage.Value
myHome.LotSize = txtLotSize.Value
myHome.SalesPrice = txtSalesPrice.Value

End Sub

Private Sub cmdDisplayHomeData_Click()
MsgBox myHome.StreetAddress & myHome.City & myHome.State &
myHome.SquareFootage & myHome.LotSize & myHome.SalesPrice & " Has been
entered"

End Sub
 
M

Marshall Barton

JudithSpurlock said:
This is part of my code for the module i don't know if it's correct
Option Compare Database
Option Explicit

'Define User defined type in a standard module

Type Home

StreetAddress As String
City As String
State As String
SquareFootage As Integer
LotSize As Integer
SalesPrice As Currency

End Type

This is another part of my code for the click events and it's giving me an
error
Option Compare Database


Private Sub cmdAddHome_Click()

'Declare one variable of HomeData Type
Dim myHome As Home

myHome.StreetAddress = txtStreetAddress.Value
myHome.City = txtCity.Value
myHome.State = txtState.Value
myHome.SquareFootage = txtSquareFootage.Value
myHome.LotSize = txtLotSize.Value
myHome.SalesPrice = txtSalesPrice.Value

End Sub

Private Sub cmdDisplayHomeData_Click()
MsgBox myHome.StreetAddress & myHome.City & myHome.State &
myHome.SquareFootage & myHome.LotSize & myHome.SalesPrice & " Has been
entered"

End Sub


The myHome variable is local to the AddHome click event so
it is discarded at the End Sub. Move the lines:

'Declare one variable of HomeData Type
Dim myHome As Home

to just below the End Type line.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top