Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2004

    Unanswered: VBA question boxes? More help on my postcode DB please!!! :)

    OK.... thanks all for your help so far.

    My database now allows me to key in a UK postcode and autocompletes the street name, town and county on the form in use. Now being rubbish I don't know how to do this next bit... is there any way in my VBA that I can add in a function that pops up a box and asks for a house number and then adds it in to the beginning of the street name.... my script so far goes like this...

    Private Sub Post_Code_BeforeUpdate(Cancel As Integer)

    Dim Strg As Variant
    Dim Strg1 As Variant
    Dim Strg2 As Variant

    Strg = DLookup("[PCS3!Street]", "PCS3", _
    "[PCS3!PostCode] = '" & Me.Post_Code & "'")

    If Not IsNull(Strg) Then Me.Address_Line_1 = Strg

    Strg1 = DLookup("[PCS3!Town]", "PCS3", _
    "[PCS3!PostCode] = '" & Me.Post_Code & "'")

    If Not IsNull(Strg1) Then Me.Address_Line_2 = Strg1

    Strg2 = DLookup("[PCS3!County]", "PCS3", _
    "[PCS3!PostCode] = '" & Me.Post_Code & "'")

    If Not IsNull(Strg2) Then Me.Address_Line_3 = Strg2

    End Sub

    So basically, when i type the postcode in, I want a box to then come up to ask for a house number and then whatever is typed in is added at the start of the street name (address_line_1) field.

    Your all stars! Thanks in advance!

    Garry, Brighton UK.

  2. #2
    Join Date
    Nov 2003
    Hi Garry....I've already answered this in your previous post

    but here it goes again
    If Not IsNull(Strg) Then
       Dim HouseNum As String
       HouseNum = InputBox("Please enter the related house number...", "House Number?") 
       If HouseNum <> "" then Strg = HouseNum & " " & Strg
       Me.Address_Line_1 = Strg
    End IF

  3. #3
    Join Date
    Jun 2004


    Hey hey

    Thanks, you're a star - shining brightly in the sky

    It's all good now!!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts