M
Matt Spoljarevic
Hello
Could someone please help me with the below?
I know this will probably be very basic, but my knowledge of VB is extremely
limited, and I am at a loss of how to do it.
I am creating a form to input property details for jobs we receive to do.
(Building Maintenance Company)
Using the code below I have set it up so that if I enter a street address
(e.g. “10 Long Stâ€) and this address has previously been entered, the next 9
fields on the form will automatically be filled with the pre-existing
information.
This is working fine, however when a new address is entered (one that does
not already exist in the table) I receive an IsNull error message, because
there is no corresponding information to fill the next 9 fields.
To fix this I would like to put an If/Then statement in to find if the
address I enter already exists or not, and if not it will ignore the code
and allow me to enter the other data manually.
What I have already is:
Private Sub Site_Address_AfterUpdate()
(I would like to insert an IF/Then Here. To only run the below if it is a
what I enter in the [Site_Address] field is a duplicate)
Dim burb As String, Ten As String
Dim Cont As String, Tenph As String, Tenph2 As String
Dim Instruct As String, Client As String, Cltph As String, Email
As String
burb = Me.Site_Address.Column(1)
Ten = Me.Site_Address.Column(2)
Cont = Me.Site_Address.Column(3)
Tenph = Me.Site_Address.Column(4)
Tenph2 = Me.Site_Address.Column(5)
Instruct = Me.Site_Address.Column(6)
Client = Me.Site_Address.Column(7)
Cltph = Me.Site_Address.Column(8)
Email = Me.Site_Address.Column(9)
Me.Site_Suburb.Value = burb
Me.Tenant.Value = Ten
Me.Site_Contact.Value = Cont
Me.Site_Contact_Ph_1 = Tenph
Me.Site_Contact_Ph_2.Value = Tenph2
Me.Instructions.Value = Instruct
Me.Client_Contact.Value = Client
Me.Client_Contact_Ph.Value = Cltph
Me.Client_Contact_Email.Value = Email
End Sub
Any help would be greatly appreciated
Thank you in advance
Regards
Matt
Could someone please help me with the below?
I know this will probably be very basic, but my knowledge of VB is extremely
limited, and I am at a loss of how to do it.
I am creating a form to input property details for jobs we receive to do.
(Building Maintenance Company)
Using the code below I have set it up so that if I enter a street address
(e.g. “10 Long Stâ€) and this address has previously been entered, the next 9
fields on the form will automatically be filled with the pre-existing
information.
This is working fine, however when a new address is entered (one that does
not already exist in the table) I receive an IsNull error message, because
there is no corresponding information to fill the next 9 fields.
To fix this I would like to put an If/Then statement in to find if the
address I enter already exists or not, and if not it will ignore the code
and allow me to enter the other data manually.
What I have already is:
Private Sub Site_Address_AfterUpdate()
(I would like to insert an IF/Then Here. To only run the below if it is a
what I enter in the [Site_Address] field is a duplicate)
Dim burb As String, Ten As String
Dim Cont As String, Tenph As String, Tenph2 As String
Dim Instruct As String, Client As String, Cltph As String, Email
As String
burb = Me.Site_Address.Column(1)
Ten = Me.Site_Address.Column(2)
Cont = Me.Site_Address.Column(3)
Tenph = Me.Site_Address.Column(4)
Tenph2 = Me.Site_Address.Column(5)
Instruct = Me.Site_Address.Column(6)
Client = Me.Site_Address.Column(7)
Cltph = Me.Site_Address.Column(8)
Email = Me.Site_Address.Column(9)
Me.Site_Suburb.Value = burb
Me.Tenant.Value = Ten
Me.Site_Contact.Value = Cont
Me.Site_Contact_Ph_1 = Tenph
Me.Site_Contact_Ph_2.Value = Tenph2
Me.Instructions.Value = Instruct
Me.Client_Contact.Value = Client
Me.Client_Contact_Ph.Value = Cltph
Me.Client_Contact_Email.Value = Email
End Sub
Any help would be greatly appreciated
Thank you in advance
Regards
Matt