Variant not getting the value

schalkse

Registered User.
Local time
Today, 12:37
Joined
Apr 20, 2005
Messages
51
Hi guys, this worked under access 2000, but not anymore under 2003
"strtrans" is not getting the value.
I can't find what's wrong, tried string, defininf them in a module. Nothing.
Anybody any idea why that is?
Here's the code:

Dim strTable As Variant
Dim strField As Variant
Dim strtrans As Variant
Dim stDocName1 As Variant
Dim stDocName As Variant
stDocName1 = "qerDelActieTabel"
stDocName = "qerUpdateActietabel"
On Error GoTo Err_Knop20_Click
Me.Probleem.SetFocus
If Me.Probleem.Text = "" Then
DoCmd.Close
Else
Me.Appcode.SetFocus
If Me.Appcode.Text = "" Then
strTable = "tblActie"
strField = "Probleem"
strtrans = Me.Ingavedatum.Value
strtrans = strtrans & "ac" & DCount(strField, strTable)
Me.Appcode.Text = strtrans
MsgBox sttrans & strField & strTable & stDocName & stDocName1
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
DoCmd.OpenQuery stDocName, acNormal, acEdit
DoCmd.Close
Else
MsgBox sttrans & strField & strTable & stDocName & stDocName1
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
DoCmd.OpenQuery stDocName1, acNormal, acEdit
DoCmd.OpenQuery stDocName, acNormal, acEdit
DoCmd.Close
End If
End If
Exit_Knop20_Click:
Exit Sub

Err_Knop20_Click:
MsgBox Err.Description
Resume Exit_Knop20_Click

(eddited for clarity)
 
Last edited:
Ok, have to admit, i did not say which variant is not getting the string.
Its the strtrans that's not getting the value.
The query does run
 
Why are you dimensioning strings as Variants? It is confusing.

And, as Rich says, update your code to use the contemporary DoCmd.RunCommand methods and not the ten years out of date DoCmd.DoMenuItem methods.
 
Me.Appcode.Text = strtrans
MsgBox sttrans & strField & strTable & stDocName & stDocName1

Looks like a spelling error to me. set option explict in your module and see what happens

Peter
 
SJ McAbney said:
Why are you dimensioning strings as Variants? It is confusing.

And, as Rich says, update your code to use the contemporary DoCmd.RunCommand methods and not the ten years out of date DoCmd.DoMenuItem methods.

Becaus they were first strings, that's why. (For me it's stil code that's not finnished, once the shit works i will change it) About the docmd thing, my access does that, i am not a programmer, so how the heck can i now it's then years old. ;)
My whole project is made in access 2000 and i am not gonna change all the DoMenuItem's in runcommand. I tried one form and i got error's which i don't even know how to solve those. So they stay.
Still "strtrans" does not get any value, the rest does.
 
Bat17 said:
Looks like a spelling error to me. set option explict in your module and see what happens

Peter

thanks for finding that spelling error, it's corrected, but still the strtrans does not get the value passed in this line : " strtrans = Me.Ingavedatum.Value
strtrans = strtrans & "ac" & DCount(strField, strTable)"

:(
 
schalkse said:
Becaus they were first strings, that's why.

Then why retain the str prefix? Why not replace them with var so you can identify them? :confused:

My whole project is made in access 2000 and i am not gonna change all the DoMenuItem's in runcommand.

Access wizards have not been updated since Acess 95 despite the new RunCommand method superceding it.

Have you stepped through your code by making checkpoints in order to debug it?
 
have you checked the values going in?

msgbox "Ingavedatum = " & Me.Ingavedatum.Value
strtrans = Me.Ingavedatum.Value
msgbox "strtrans =" & strtrans
msgbox "Dcount =" & DCount(strField, strTable)
strtrans = strtrans & "ac" & DCount(strField, strTable)
msgbox "strtrans =" & strtrans

This may help track down what is going on

Peter
 

Users who are viewing this thread

Back
Top Bottom