I cannot see my VBA code

You can have an iif() or string functions, etc most anywhere - :)
 
Those are not VBA code Ken - those are native functions.
 
If you put an iif() in a query then I think it's safe to say that you put a piece of vba code in the query since iif() is the vba library. The object browser doesn't show it in 'native' access anything as far as I can find - :)
 
Not at all. The user said his code zonked and you said he couldn't have code where he said he had it. Looks like he tried to put an if statement in somewhere to control the user input (or something) and your answer sounded like he would have to do it in a module. I was simply replying that he could (maybe?) put a pc of code, say an iif() in somewhere other than a module to do what he wanted.
 
Fat chance - we probably run him off by now :p ... Sorry, I'll shut up :)
 
Hi people,

As you can see in the attached file, there is no code but the form is still there and if you try to open the vba window from the form you cannot see it.

I had something like that inside the form: (it's a piece of the code)

Private Sub cmdsalvar_Click()
On Error GoTo Err_cmdsalvar_Click
If IsNull(Nome.Value) Then
MsgBox "O campo Nome obrigatório!", vbCritical
Nome.SetFocus
Exit Sub
End If

DoCmd.GoToRecord , , acNewRec
Exit_cmdsalvar_Click:
hide
MsgBox "Dados gravados com sucesso", vbInformation
DoCmd.Close , , acSaveNo
Exit Sub
Err_cmdsalvar_Click:
MsgBox Err.Description
Resume Exit_cmdsalvar_Click

End Sub
Private Sub cmd_Click()
If Not IsNull(DLookup("perfil", "user", "numero = " & Me.txtnumero)) Then
a = DLookup("perfil", "user", "numero = " & Me.txtnumero)
Numero.SetFocus
Numero.Text = Me.txtnumero
Else
On Error GoTo Err_cmd_Click

DoCmd.GoToRecord , , acNewRec
Exit_cmd_Click:
Exit Sub
Err_cmd_Click:
MsgBox Err.Description
Resume Exit_cmd_Click
End If
End Sub
Private Sub cmdverifica_Click()
If IsNull(txtverifica) Then
MsgBox "O número da conta não pode ser nulo", vbCritical
txtverifica.SetFocus
Exit Sub
ElseIf Len(txtverifica.Value) <> 20 Then
MsgBox "Conta inválida! a conta deve conter 20 dígitos!", vbCritical
txtverifica.SetFocus
Exit Sub
End If
Dim Nome As String
If Not IsNull(DLookup("nome", "contas", "conta = " & Str(Me.txtverifica))) Then
Nome = DLookup("nome", "contas", "conta = " & Me.txtverifica)
subform.Visible = True
disabled
lbl2.Caption = Nome
regra1
Else
DoCmd.GoToRecord , "Contas_Segmentation", acNewRec
On Error GoTo Err_cmdverifica_Click
show
Conta.SetFocus
'Criar uma function para isso
Conta.Text = txtverifica.Value
cmdsalvar.Visible = True
cmdcancelar.Visible = True
Funcionalidade.SetFocus
Conta.enabled = False
txtverifica.enabled = False
cmdverifica.enabled = False
Exit_cmdverifica_Click:
Exit Sub
Err_cmdverifica_Click:
MsgBox Err.Description
Resume Exit_cmdverifica_Click
Exit Sub
cmdverifica_Click:
MsgBox Err.Description
Exit Sub
End If

End Sub

Rgds,
 

Attachments

Bob's right, you had all of that in a form module. I'll let him look at it :)
 
On second thought - (:p) As it looks like your code IS gone, I would simply open the form in design view, click on View->code and paste the entire chuck of code back into your module - ???
 
In case it escaped your notice, when I do that it is directly to SCREENSHOTS which make it easier to explain since they can see what I would be trying to take several sentences, or paragraphs, to try to explain. That's why I created the website in the first place - to make it easier to answer many frequently asked questions and in a more visual way.


Agreed this was my first thought also, dose the code work actively see if you can get it to error then debug it.
 

Users who are viewing this thread

Back
Top Bottom