Please help me adjust a code. I’m trying to work with one of the samples from the class that I took last Spring but I’m botching it up. I really need it for a database that I’m building here at work. I have several questions so please bear with me.
I have a check box [SPLIT] on a subform [sfrmDirectoryCodes], which when checked should bring up an Input box. The input box should ask them to enter in the member number. The member number would then go into the unbound text box [txtPurchasingShop] on the mainform [sfrmDirectory]. Once the member number has been filled in, I don’t want the input box to pop up again for the same record on the mainform because they could be selecting several items at one time on the subform. It should pop up again if they go back in later and submit a new request though.
1. Formatting the member number – The format has to be Two Numbers, a Hyphen, Four Numbers and then Two Letters. I don’t know how to write that and wouldn’t know where to put that into the code. # # – # # # #LL??? Can you PLEASE add this in to the correct code?
2. Unbound text box – The class example used an unbound text box but I need mine to fill in a field on the mainform. txtPurchasingShop filling in field PurchasingShop#. PurchasingShop# is found in tblDirectory if that matters.
This is what I tried:
Private Sub SPLIT_Click()
If [SPLIT] = True Then
[txtPurchasingShop] = InputBox(“Please enter the member number for the PURCHASING shop.”, _
“PurchasingShop#”)
If [txtPurchasingShop] = “” Then
txtPurchasingShop.Visible = False
Else
txtPurchasingShop.Visible = True
End If
Else
txtPurchasingShop.Visible = False
End If
If txtPurchasingShop.Visible Then
End If
End If
End Sub
3. I don’t remember what this part of the code was for. I think that it referred to the text box label so I used the name of the field that I wanted to fill in instead.
.”, _
“PurchasingShop#”)
The class example prompted other InputBoxes to pop up so I may have cut out too much or too little. It’s probably not working because the example was all on one form and I’m trying to have the check box on the subform and the text box on the main form. Either way, I just don’t get it.
PLEASE HELP – I’ve tried adjusting it so many times my head is spinning.
Thanks