Avatar of Scott Lamond
Scott Lamond
Flag for United States of America

asked on 

Using Hidden Field to Collect User Input in Access Form

Using Visual Basic with an Access database.
I created a form to copy existing product specifications from an existing product number to a new product number.

We need to collect the source # from the user (as Snumber), copy those specs into two temporary tables, then get the target # from the user (as Tnumber) and copy the specs from the temporary tables and append them to the permanent tables, changing only the Product # to be equal to Tnumber.

Here's the code in the Open Event in which I get a compile error at "Me.HiddenField = Snumber".
The error reads:  "Method or data member not found".

I'm no expert at writing VB code so I'm sure there is a statement missing or some missing global declaration?

Private Sub Form_Open(Cancel As Integer)
    Dim Snumber As String
    Dim Tnumber As String
    Snumber = InputBox("Source Product# ?")
    Me.HiddenField = Snumber
    DoCmd.OpenQuery "qryQCPH"
    DoCmd.OpenQuery "qryQCPT"
    Tnumber = InputBox("Target Product# ?")
    Me.HiddenField = Tnumber
    DoCmd.OpenQuery "qryQCPH2"
    DoCmd.OpenQuery "qryQCPT2"
    DoCmd.OpenQuery "qryQCPHappend"
    DoCmd.OpenQuery "qryQCPTappend"
    DoCmd.SetWarnings True
    Cancel = True
End Sub
Microsoft AccessVisual Basic ClassicVB Script

Avatar of undefined
Last Comment
omgang

8/22/2022 - Mon